Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!