Bug 827206 - OS.File.exists for Windows should now work on directories. r=froydnj

This commit is contained in:
David Rajchenbach-Teller 2013-01-07 21:29:22 -05:00
parent e46967256c
commit 4991a52dc6
2 changed files with 8 additions and 2 deletions

View File

@ -314,7 +314,7 @@
};
/**
* Checks if a file exists
* Checks if a file or directory exists
*
* @param {string} path The path to the file.
*
@ -322,7 +322,7 @@
*/
File.exists = function Win_exists(path) {
try {
let file = File.open(path);
let file = File.open(path, FILE_STAT_MODE, FILE_STAT_OPTIONS);
file.close();
return true;
} catch (x) {

View File

@ -787,5 +787,11 @@ function test_exists_file()
info("test_exists_file: starting");
ok(OS.File.exists(file_name), "test_exists_file: file exists (OS.File.exists)");
ok(!OS.File.exists(file_name + ".tmp"), "test_exists_file: file does not exists (OS.File.exists)");
let dir_name = OS.Path.join("chrome", "toolkit", "components" ,"osfile",
"tests", "mochi");
ok(OS.File.exists(dir_name), "test_exists_file: directory exists");
ok(!OS.File.exists(dir_name) + ".tmp", "test_exists_file: directory does not exist");
info("test_exists_file: complete");
}