mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
Update todo.js
This commit is contained in:
parent
57610a01c1
commit
349be5b9c3
1 changed files with 5 additions and 5 deletions
|
|
@ -65,17 +65,17 @@ class TodoService extends Service {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._todoPath = `${GLib.get_user_cache_dir()}/ags/user/todo.json`;
|
this._todoPath = `${GLib.get_user_cache_dir()}/ags/user/todo.json`;
|
||||||
if (!fileExists(this._todoPath)) { // No? create file with empty array
|
try {
|
||||||
|
const fileContents = Utils.readFile(this._todoPath);
|
||||||
|
this._todoJson = JSON.parse(fileContents);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
Utils.exec(`bash -c 'mkdir -p ${GLib.get_user_cache_dir()}/ags/user'`);
|
Utils.exec(`bash -c 'mkdir -p ${GLib.get_user_cache_dir()}/ags/user'`);
|
||||||
Utils.exec(`touch ${this._todoPath}`);
|
Utils.exec(`touch ${this._todoPath}`);
|
||||||
Utils.writeFile("[]", this._todoPath).then(() => {
|
Utils.writeFile("[]", this._todoPath).then(() => {
|
||||||
this._todoJson = JSON.parse(Utils.readFile(this._todoPath))
|
this._todoJson = JSON.parse(Utils.readFile(this._todoPath))
|
||||||
}).catch(print);
|
}).catch(print);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
const fileContents = Utils.readFile(this._todoPath);
|
|
||||||
this._todoJson = JSON.parse(fileContents);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue