v3mt
Version:
A CLI toolkit for managing and deploying Victoria 3 mods, including sending mod files to the game, launching the game, and more.
20 lines (19 loc) • 1.04 kB
JavaScript
import promptSelectFile from '../../../tools/prompts/select-filesystem.js';
import findGameDirectory from '../../../utils/filesystem/game/find-game-directory.js';
import Logger from '../../../utils/logger/logger.js';
export default async function requestGameFolder() {
const foundGameDirectory = findGameDirectory();
if (!foundGameDirectory) {
Logger.warn('Victoria 3 game directory not found in common Steam locations');
}
// TODO: setting the default folder to C:/Program Files (x86) restricts where we can select from the folder select prompt
// const programFilesPath = path.resolve('C:/Program Files (x86)');
// const programFilesDirectory = fs.existsSync(programFilesPath) ? programFilesPath : null;
const GAME_FOLDER = await promptSelectFile({
type: 'folder',
message: 'Please select game folder (example: C:/Program Files (x86)/Steam/steamapps/common/Victoria 3/game)',
default: foundGameDirectory ?? undefined,
required: true,
});
return GAME_FOLDER;
}