Jump to content

Support Request - Variable for Mod Name


ChemBoy1
Go to solution Solved by Pickysaurus,

Recommended Posts

I am attempting to write an installer function for one of my Vortex extensions, and I need to know what is the correct variable name to use for a mod's name so that I can create a folder with that name to set the install location. 

 

Basically, what should be the "VARIABLE" in the function below to pass the name of the mod into the function and create a folder above the mod file with that mod name. Note that I cannot use "rootPath" in this case as there is no directory above the mod file. I have tried things like "modName", "archiveName", and "modId" but these cause errors. 

 

function installChairMod(files, VARIABLE) { // <--pass variable into function here
  const modFile = files.find(file => path.basename(file).toLocaleLowerCase() === CHAIRMOD_FILE);
  const idx = modFile.indexOf(path.basename(modFile));
  const rootPath = path.dirname(modFile);
  const setModTypeInstruction = { type: 'setmodtype', value: CHAIRMOD_ID};

  const filtered = files.filter(file =>
    ((file.indexOf(rootPath) !== -1) &&
      (!file.endsWith(path.sep))));

  const instructions = filtered.map(file => {
    return {
      type: 'copy',
      source: file,
      destination: path.join(VARIABLE, file.substr(idx)), // <-- Need to add folder with the name of the mod here
    };
  });
  instructions.push(setModTypeInstruction);

  return Promise.resolve({ instructions });
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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