[svn:parrot] r39026 - trunk/src

allison at svn.parrot.org allison at svn.parrot.org
Thu May 21 22:36:17 UTC 2009


Author: allison
Date: Thu May 21 22:36:16 2009
New Revision: 39026
URL: https://trac.parrot.org/parrot/changeset/39026

Log:
[cage] Update library loading so it loads the file as bytecode or source
based on the extension of the file that's found, rather than just using
the requested extension, so defaulting to .pir from .pbc will work.

Modified:
   trunk/src/packfile.c

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Thu May 21 22:35:30 2009	(r39025)
+++ trunk/src/packfile.c	Thu May 21 22:36:16 2009	(r39026)
@@ -4822,6 +4822,7 @@
 {
     ASSERT_ARGS(Parrot_load_bytecode)
     STRING         *wo_ext, *ext, *pbc, *path;
+    STRING         *found_path, *found_ext;
     PMC            *is_loaded_hash;
     enum_runtime_ft file_type;
 
@@ -4853,6 +4854,16 @@
     /* remember wo_ext => full_path mapping */
     VTABLE_set_string_keyed_str(interp, is_loaded_hash, wo_ext, path);
 
+    parrot_split_path_ext(interp, path, &found_path, &found_ext);
+
+    /* Check if the file found was actually a bytecode file (.pbc
+     * extension) or a source file (.pir or .pasm extension). */
+
+    if (Parrot_str_equal(interp, found_ext, pbc))
+        file_type = PARROT_RUNTIME_FT_PBC;
+    else
+        file_type = PARROT_RUNTIME_FT_SOURCE;
+
     compile_or_load_file(interp, path, file_type);
 }
 


More information about the parrot-commits mailing list