Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

274
Visualizações
Include a variable in child_process electron

I am new to electron and this forum, I want to move a file to a certain location on a computer with a drag and drop of a file in an electron program using child_process. the file must be moved on the click of a button, here is my code:

  document.addEventListener('dragover', (e) => {
    e.preventDefault();
    e.stopPropagation();
});

document.addEventListener('drop', (event) => {
    event.preventDefault();
    event.stopPropagation();

    let pathArr = [];
    for (const f of event.dataTransfer.files) {
        // Using the path attribute to get absolute file path
        console.log('File Path of dragged files: ', f.path)
        pathArr.push(f.path); // assemble array for main.js
        const apply = document.getElementById('apply')
apply.addEventListener('click', () => {
applyTheme()
});
        async function applyTheme() {
          const { stdout, stderr } = await exec('mv ', f.path, ' %userprofile%\\.spicetify\\Themes');
        
          if (stderr) {
            console.error(`error: ${stderr}`);
          }
          console.log(`${stdout}`);
          
        };
    }
    console.log(pathArr);
    
});

but I get this error:

Uncaught (in promise) TypeError: The argument 'args' is invalid. Received ' %userprofile%\\.spicetify\\Themes'
    at __node_internal_captureLargerStackTrace (node:internal/errors:464)
    at new NodeError (node:internal/errors:371)
    at Object.execFile (node:child_process:312)
    at Object.t.<computed> [as execFile] (node:electron/js2c/asar_bundle:5)
    at exec (node:child_process:235)
    at node:child_process:244
    at node:electron/js2c/asar_bundle:5
    at applyTheme (renderer.js:101)
    at HTMLButtonElement.<anonymous> (renderer.js:98)
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda