ChemBoy1 Posted August 5 Share Posted August 5 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 More sharing options...
insomnious Posted August 5 Share Posted August 5 Hey @ChemBoy1 Can you post in #vortex-dev on the Discord please and provide a bit more context on what code is calling this function. You can pass in anything you like to the function but we need a bit more info. Thanks insomnious Link to comment Share on other sites More sharing options...
insomnious Posted August 5 Share Posted August 5 Is this what you need? Regards, insomnious Link to comment Share on other sites More sharing options...
Solution Pickysaurus Posted August 5 Solution Share Posted August 5 The destinationPath can be converted to the archive name (e.g. path.basename(destinationPath)) Link to comment Share on other sites More sharing options...
ChemBoy1 Posted August 5 Author Share Posted August 5 7 hours ago, Pickysaurus said: The destinationPath can be converted to the archive name (e.g. path.basename(destinationPath)) That's exactly what I needed. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now