different startDir for linux; basic linux support

toast
Kit Kasune 3 years ago
parent 6248443bb2
commit 182ce762f5
  1. 5928
      package-lock.json
  2. 4
      scripts/contextmenu/newfolder.js
  3. 10
      scripts/fileview/load/load.js
  4. 2
      scripts/fileview/load/render.js
  5. 3
      scripts/keybinds/process/handleIpc.js
  6. 16
      scripts/startup/preload.js

5928
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -57,9 +57,9 @@ module.exports = () => {
lightRefresh();
modalOut.remove();
newToast(
"Folder created", [`Folder "${input.value}" created successfully`, `<em>${window.kade.cpath}\\${input.value}</em>`], undefined, false, 5,
"Folder created", [`Folder "${input.value}" created successfully`, `<em>${window.kade.cpath}/${input.value}</em>`], undefined, false, 5,
() => {
refresh(`${window.kade.cpath}\\${input.value}`);
refresh(`${window.kade.cpath}/${input.value}`);
require('electron').clipboard.writeText(`${window.kade.cpath}`);
newToast("Copied!", "<em>The folder's path has been copied to your clipboard.</em>", "#19df46");
}

@ -15,17 +15,17 @@ module.exports = (check=false) => {
for (const file of ldir) {
let ofile = {};
ofile.icon = fileIcon(`${dir}\\${file}`, file);
ofile.icon = fileIcon(`${dir}/${file}`, file);
ofile.name = trimext.includes(path.extname(file)) ? file.slice(0, file.length - path.extname(file).length) : file;
try {ofile.type = fs.lstatSync(`${dir}\\${file}`).isDirectory() ? "File Folder" : (extensions[path.extname(file).slice(1)] || "File");}
try {ofile.type = fs.lstatSync(`${dir}/${file}`).isDirectory() ? "File Folder" : (extensions[path.extname(file).slice(1)] || "File");}
catch {ofile.type = `${path.extname(file)} File`.trim();}
try {ofile.lastModified = new Date(fs.lstatSync(`${dir}\\${file}`).mtimeMs);}
try {ofile.lastModified = new Date(fs.lstatSync(`${dir}/${file}`).mtimeMs);}
catch {ofile.lastModified = 0;}
try {ofile.lastModifiedString = ofile.lastModified === 0 ? '' : moment(ofile.lastModified).format('M/D/YYYY, h:mm:ssa');}
catch {ofile.lastModifiedString = '';}
try {
if (fs.lstatSync(`${dir}\\${file}`).isFile()) {
ofile.size = fs.lstatSync(`${dir}\\${file}`).size;
if (fs.lstatSync(`${dir}/${file}`).isFile()) {
ofile.size = fs.lstatSync(`${dir}/${file}`).size;
ofile.sizeString = `${getsize(ofile.size)}`;
ofile.dir = false;
} else {

@ -15,7 +15,7 @@ module.exports = (dir, options) => {
if (options.animate) {cfc.classList.add('rise');}
cfc.onclick = function () {
window.kade.elc = true;
if (cfc.classList.contains('file-active')) {if (file.dir) {refresh(`${window.kade.cpath}\\${file.name}`);}}
if (cfc.classList.contains('file-active')) {if (file.dir) {refresh(`${window.kade.cpath}/${file.name}`);}}
cfc.classList.add('file-active');
if (window.kade.cl) {window.kade.cl.classList.remove('file-active');}
window.kade.cl = cfc;

@ -4,4 +4,7 @@ module.exports = (browserWindow, app) => {
ipc.on('keybind', (event, arg) => {
try {event.returnValue = require(`./${arg}`)(browserWindow, app);} catch {}
});
ipc.on('preload', (event, arg) => {
if (arg === 'request-platform') {event.returnValue = process.platform;}
});
};

@ -22,10 +22,22 @@ window.addEventListener('DOMContentLoaded', () => {
version: {
name: "Alpha",
semver: require('../../package.json').version
}
},
platform: undefined
};
const startDir = `${os.homedir}\\Desktop`;
const platform = ipcRenderer.sendSync('preload', 'request-platform');
window.kade.platform = platform;
let startDir
switch (platform) {
case 'win32':
startDir = `${os.homedir}\\Desktop`;
break;
case 'linux':
startDir = `/home`;
break;
}
require('./initcontext')();

Loading…
Cancel
Save