@@ -250,29 +250,15 @@ impl DenoDir {
250250
251251 match j. scheme ( ) {
252252 "file" => {
253- let mut p = j
254- . to_file_path ( )
255- . unwrap ( )
256- . into_os_string ( )
257- . into_string ( )
258- . unwrap ( ) ;
259-
260- if cfg ! ( target_os = "windows" ) {
261- // On windows, replace backward slashes to forward slashes.
262- // TODO(piscisaureus): This may not me be right, I just did it to make
263- // the tests pass.
264- p = p. replace ( "\\ " , "/" ) ;
265- }
266-
267- module_name = p. to_string ( ) ;
268- filename = p. to_string ( ) ;
253+ let mut p = fs:: normalize_path ( j. to_file_path ( ) . unwrap ( ) . as_ref ( ) ) ;
254+ module_name = p. clone ( ) ;
255+ filename = p;
269256 }
270257 _ => {
271258 module_name = module_specifier. to_string ( ) ;
272- filename = get_cache_filename ( self . deps . as_path ( ) , j)
273- . to_str ( )
274- . unwrap ( )
275- . to_string ( ) ;
259+ filename = fs:: normalize_path (
260+ get_cache_filename ( self . deps . as_path ( ) , j) . as_ref ( ) ,
261+ )
276262 }
277263 }
278264
@@ -422,6 +408,13 @@ fn test_src_file_to_url() {
422408fn test_resolve_module ( ) {
423409 let ( _temp_dir, deno_dir) = test_setup ( ) ;
424410
411+ let d = fs:: normalize_path (
412+ deno_dir
413+ . deps
414+ . join ( "localhost/testdata/subdir/print_hello.ts" )
415+ . as_ref ( ) ,
416+ ) ;
417+
425418 let test_cases = [
426419 (
427420 "./subdir/print_hello.ts" ,
@@ -453,13 +446,13 @@ fn test_resolve_module() {
453446 add_root ! ( "/this/module/got/imported.js" ) ,
454447 add_root ! ( "/this/module/got/imported.js" ) ,
455448 ) ,
449+ (
450+ "http://localhost:4545/testdata/subdir/print_hello.ts" ,
451+ add_root ! ( "/Users/rld/go/src/github.com/denoland/deno/testdata/006_url_imports.ts" ) ,
452+ "http://localhost:4545/testdata/subdir/print_hello.ts" ,
453+ d. as_ref ( ) ,
454+ ) ,
456455 /*
457- (
458- "http://localhost:4545/testdata/subdir/print_hello.ts",
459- add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/006_url_imports.ts"),
460- "http://localhost:4545/testdata/subdir/print_hello.ts",
461- path.Join(SrcDir, "localhost:4545/testdata/subdir/print_hello.ts"),
462- ),
463456 (
464457 path.Join(SrcDir, "unpkg.com/[email protected] /index.ts"), 465458 ".",
0 commit comments