[svn:parrot] r44303 - trunk/tools/dev
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Mon Feb 22 19:58:35 UTC 2010
Author: plobsing
Date: Mon Feb 22 19:58:33 2010
New Revision: 44303
URL: https://trac.parrot.org/parrot/changeset/44303
Log:
use config['slash'] to determine native file separator (in case it is neither '\\' or '/')
Modified:
trunk/tools/dev/nci_thunk_gen.pir
Modified: trunk/tools/dev/nci_thunk_gen.pir
==============================================================================
--- trunk/tools/dev/nci_thunk_gen.pir Mon Feb 22 19:36:02 2010 (r44302)
+++ trunk/tools/dev/nci_thunk_gen.pir Mon Feb 22 19:58:33 2010 (r44303)
@@ -1071,9 +1071,16 @@
.param pmc extns :slurpy
.local string dir, file, extn
- $P0 = split "\\", full_path
+
+ # replace native file separator with '/'
+ $S0 = 'native_file_separator'()
+ $P0 = split $S0, full_path
file = join "/", $P0
+ $P0 = split '/', file
+ file = pop $P0
+ dir = join '/', $P0
+
extn_loop:
unless extns goto end_extn_loop
$S0 = shift extns
@@ -1085,21 +1092,16 @@
substr file, $I1, $I0, ''
end_extn_loop:
- .const string file_sep = '/'
-
- strip_dir_loop:
- $I0 = index file, file_sep
- if $I0 < 0 goto end_strip_dir_loop
- inc $I0
- $S0 = substr file, 0, $I0
- dir = concat dir, $S0
- file = substr file, $I0
- goto strip_dir_loop
- end_strip_dir_loop:
-
.return (dir, file, extn)
.end
+.sub 'native_file_separator'
+ load_bytecode 'config.pbc'
+ $P0 = '_config'()
+ $S0 = $P0['slash']
+ .return ($S0)
+.end
+
.sub 'alternate_whitespaces' :anon :immediate
$P0 = new ['ResizableStringArray']
push $P0, "\t"
More information about the parrot-commits
mailing list