Jump to content

Vortex warns about invalid mod installer with custom install func


ALazyWizard

Recommended Posts

Never mind, I was being stupid. It turns out I'd disabled 'mergeMods' while tracking down an earlier issue and forgotten about it. Re-enabling it solved the problem and removed the need for a custom installer entirely. Way to overcomplicate things, me.

 

 

 

I'm writing an extension adding Vortex support for a game. By convention, all of that game's mod archives include a subfolder before the actual mod files, and Vortex incorrectly extracts that subfolder into the mod's folder, preventing the mod from being recognized.

 

I wrote a custom installer that moves all files from the subfolder to the root folder. This works, but Vortex complains about invalid mod installers (specifically, files that don't exist) and file conflicts:

 

 

68H3TDX.png

kL6Lk52.png

 

 

 

Am I doing something wrong? Like I said, this works aside from the warning, but is there a better way of doing this?

 

Here's the code I'm using for the InstallFunc at the moment (pardon the ugliness, it's still very much a WIP):

/**
 * @param {String[]} files
 */
function installStarsectorMod(files) {
  // By convention, all Starsector mod archives include a subfolder in their root
  // This method finds mod_info.json and considers that the installation root
  const modInfo = files.find(file => path.basename(file).indexOf('mod_info.json') == 0);
  if (modInfo == undefined) return Promise.reject(new Error('mod_info.json not found'));

  const cutoff = modInfo.indexOf(path.basename(modInfo));
  const instructions = files.filter(file => file.length > cutoff).map(file => {
    const newPath = file.substr(cutoff);
    vortex.log('info', 'Adjusted path for "' + file + '": "' + newPath + '"');
    return {
      type: 'copy',
      source: file,
      destination: newPath
    };
  });
  return Promise.resolve({ instructions });
}

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...