Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda