Skip to content

Commit 61ba53c

Browse files
committed
Merge pull request #2973 from gpbowman-git/master
This is a fix for bug ID 2964. The URL to see the write up is here:
2 parents f417f92 + 6556c49 commit 61ba53c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

core/src/main/java/org/jruby/util/JRubyFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static FileResource createResource(Ruby runtime, String cwd, String path
120120

121121
public static String normalizeSeps(String path) {
122122
if (Platform.IS_WINDOWS) {
123-
return path.replace(File.separatorChar, '/');
123+
return path.replace('/', File.separatorChar);
124124
} else {
125125
return path;
126126
}

core/src/test/java/org/jruby/test/TestKernel.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
***** END LICENSE BLOCK *****/
3232
package org.jruby.test;
3333

34-
import java.util.ArrayList;
35-
34+
import java.io.File;
3635
import org.jruby.Ruby;
3736
import org.jruby.RubyException;
3837
import org.jruby.RubyFixnum;
@@ -61,15 +60,17 @@ public void testLoad() throws Exception {
6160
assertEquals("load did not load the same file several times", "1", eval("load '../test/loadTest.rb'"));
6261
}
6362

63+
6464
public void testRequire() throws Exception {
65+
char s = File.separatorChar;
6566
//reset the $loadTestvar
6667
eval("$loadTest = nil");
6768
assertEquals("failed to load the file test/loadTest", "0", eval("require '../test/loadTest'"));
6869
assertEquals("incorrectly reloaded the file test/loadTest", "", eval("require '../test/loadTest'"));
69-
70-
assertEquals("incorrect value for $\" variable", "true", eval("print $\"[-1].end_with?('test/loadTest.rb')"));
70+
assertEquals("incorrect value for $\" variable", "true", eval("print $\"[-1].end_with?('test" + s + "loadTest.rb')"));
7171
}
7272

73+
7374
public void testPrintf() throws Exception {
7475
assertEquals("hello", eval("printf(\"%s\", \"hello\")"));
7576
assertEquals("", eval("printf(\"%s\", nil)"));

0 commit comments

Comments
 (0)