Polished the BCL; started FileSystem.ios

This commit is contained in:
atanasovg
2014-03-21 16:15:04 +02:00
parent ca201cf9d7
commit 001d828eaa
6 changed files with 118 additions and 99 deletions

View File

@@ -1,5 +1,6 @@
import app_module = require("Application/application");
export class FileSystemAccess {
private _encoding = "UTF-8";
private _pathSeparator = "/";
@@ -14,18 +15,18 @@ export class FileSystemAccess {
return new Date(javaFile.lastModified());
}
public getParent(path: string, onSuccess: (path: string) => any, onError?: (error: any) => any) {
public getParent(path: string, onError?: (error: any) => any): string {
try {
var javaFile = new java.io.File(path);
if (onSuccess) {
var parent = javaFile.getParentFile();
onSuccess(parent.getPath());
}
var parent = javaFile.getParentFile();
return parent.getPath();
} catch (exception) {
// TODO: unified approach for error messages
if (onError) {
onError(exception);
}
return undefined;
}
}