An electron-based WIP aesthetic file explorer ^^
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
FileKade/scripts/fileview/checkdir.js

28 lines
1.1 KiB

const path = require('path');
const fs = require('fs');
const load = require('./load/load');
const sort = require('./load/sort');
const lightRefresh = require("./lightrefresh");
const refresh = require('../fileview/refresh');
const newToast = require("../toast/createtoast");
module.exports = () => {
if (!window.kade.cpath.length) {return;}
if (!fs.existsSync(window.kade.cpath)) {
let cp = window.kade.cpath;
while (true) {
if (!fs.existsSync(cp)) {cp = path.join(cp, '..');}
else {break;}
}
refresh(cp);
newToast("Folder Deleted", `The folder you were viewing no longer exists (this usually means it was removed from another app) so you were automatically moved to the nearest existing folder in hierarchy: <em>${cp}</em>`, '#b24355', false, 10);
}
window.kade.chdir = [];
load(true);
sort(undefined, true);
if (JSON.stringify(window.kade.cdir) !== JSON.stringify(window.kade.chdir)) {
//console.log('Detected directory updates.', JSON.stringify(window.kade.cdir), JSON.stringify(window.kade.chdir));
lightRefresh();
}
};