Skip to content

Commit

Permalink
writeFileSync return Gio.File
Browse files Browse the repository at this point in the history
  • Loading branch information
Aylur committed Feb 16, 2024
1 parent 0cf4049 commit 4ac0dbb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ export function writeFile(string: string, path: string): Promise<Gio.File> {
});
}

export function writeFileSync(string: string, path: string) {
export function writeFileSync(string: string, path: string): Gio.File {
const file = Gio.File.new_for_path(path);
return file.replace_contents(
file.replace_contents(
new TextEncoder().encode(string),
null,
false,
Gio.FileCreateFlags.REPLACE_DESTINATION,
null);
null,
);
return file;
}

const fileMonitors: Map<Gio.FileMonitor, boolean> = new Map;
Expand Down

0 comments on commit 4ac0dbb

Please sign in to comment.