mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
writeTextSync will now unlock the file when it is done writing
This commit is contained in:
@@ -245,6 +245,7 @@ export class File extends FileSystemEntity {
|
|||||||
public writeTextSync(content: string, onError?: (error: any) => any, encoding?: string): void {
|
public writeTextSync(content: string, onError?: (error: any) => any, encoding?: string): void {
|
||||||
this.checkAccess();
|
this.checkAccess();
|
||||||
|
|
||||||
|
try {
|
||||||
this[fileLockedProperty] = true;
|
this[fileLockedProperty] = true;
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
@@ -257,6 +258,9 @@ export class File extends FileSystemEntity {
|
|||||||
|
|
||||||
// TODO: Asyncronous
|
// TODO: Asyncronous
|
||||||
getFileAccess().writeText(this.path, content, localError, encoding);
|
getFileAccess().writeText(this.path, content, localError, encoding);
|
||||||
|
} finally {
|
||||||
|
this[fileLockedProperty] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private checkAccess() {
|
private checkAccess() {
|
||||||
|
|||||||
Reference in New Issue
Block a user