Kaydet (Commit) 379644b5 authored tarafından Eda Altuntaş's avatar Eda Altuntaş

Parka birlikte aç ile dosya yüklenme özelliği eklendi

üst 924f16fd
...@@ -39,6 +39,7 @@ async function createWindow() { ...@@ -39,6 +39,7 @@ async function createWindow() {
win.webContents.closeDevTools(); win.webContents.closeDevTools();
} }
}); });
require("./deep")(win);
} }
app.on("window-all-closed", () => { app.on("window-all-closed", () => {
...@@ -60,6 +61,7 @@ if (!gotTheLock) { ...@@ -60,6 +61,7 @@ if (!gotTheLock) {
if (mainWindow.isMinimized()) mainWindow.restore(); if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus(); mainWindow.focus();
} }
require("./deep")(mainWindow);
}); });
app.on("ready", async () => { app.on("ready", async () => {
if (isDevelopment && !process.env.IS_TEST) { if (isDevelopment && !process.env.IS_TEST) {
......
const { ipcMain } = require("electron");
const { spawn } = require("child_process");
const { copyFileSync, existsSync } = require("fs");
const { basename, join, posix } = require("path");
const handler = win => {
console.log(existsSync);
let file = process.argv.slice(process.argv.indexOf(process.execPath) + 1);
if (file[0].indexOf("dist_electron") !== -1) {
file = file.slice(1);
}
if (file.length === 0) {
return;
}
if (win && win.webContents) {
win.webContents.executeJavaScript(
`window.dispatchEvent(new CustomEvent('modal', { detail: {modal: true, file: '${file}'}}));`
);
}
ipcMain.on("modal_upload", (_, data) => {
const { Id, Source, Target, Username, File } = data;
copyFileSync(File, join(Source, basename(File)));
spawn("docker", [
"exec",
Id,
"cp",
"-r",
`${posix.join(Target, basename(File))}`,
`/home/${Username}/Desktop/`
]);
});
};
module.exports = handler;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment