Skip to content

Commit 9306fb7

Browse files
author
yazninja
committed
add manual edit mode (clunky)
1 parent 041c378 commit 9306fb7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/index.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { checkbox, input, select, Separator } from '@inquirer/prompts';
2-
import { file, write } from 'bun';
1+
import { checkbox, editor, input, select, Separator } from '@inquirer/prompts';
2+
import { file, spawnSync, write } from 'bun';
33
import { Database } from 'bun:sqlite';
44
import { stringify, parse } from 'ini';
55
import { checkIfProcessIsRunning, getGamePaths, exit } from './utils';
@@ -293,16 +293,21 @@ async function optimizeGraphics(tweakPath: string) {
293293
console.log('Found [SystemSettings] section in Engine.ini...');
294294
}
295295
for (let tweak of tweakChoices) {
296-
console.log('Applying', tweak);
297296
config = { ...config, ...tweaks[tweak - 1] };
298-
console.log(config);
299297
}
300298

301299
tweakData = tweakData.split('[SystemSettings]')[0] + '\n[SystemSettings]\n' + stringify(config);
302-
console.log(tweakData);
303300
await write(tweakPath, tweakData).catch(async (e) => {
304301
console.log('Error:', e.name.startsWith('EPERM') ? 'Permission Denied. Remove read-only attribute\n(You can always add it back afterwards)' : e);
305-
await exit();
302+
console.log('Executing Manual Edit Mode\n\n');
303+
304+
await editor({
305+
message: 'This is your new Engine.ini. Copy the whole file and paste them in the notepad window that opens after closing this window. Press Enter (2x) to continue.',
306+
postfix: '.ini',
307+
default: tweakData
308+
});
309+
console.log('\n\nOpening notepad with Engine.ini for you to manually edit...');
310+
spawnSync(['notepad', tweakPath]);
306311
});
307312
}
308313

0 commit comments

Comments
 (0)