Skip to content

Commit

Permalink
alot. release ready?
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostboats committed Aug 23, 2024
1 parent 382d3b1 commit 95b2492
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 25 deletions.
12 changes: 10 additions & 2 deletions commands/insertHandleUUID.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ let handleDisposable = vscode.commands.registerCommand('bg3-mod-helper.insertHan

// Update localization files with the handle
await updateLocaXmlFiles(changes);

// Save the updated localization files
const locaFiles = await vscode.workspace.findFiles('**/Localization/**/*.xml');
for (const locaFile of locaFiles) {
const document = await vscode.workspace.openTextDocument(locaFile);
await document.save(); // Save each localization XML file directly
}

console.log(`Handle ${handle} created with initial value: ${userText}`);
}
}
Expand All @@ -99,7 +107,7 @@ let handleDisposable = vscode.commands.registerCommand('bg3-mod-helper.insertHan
vscode.window.showInformationMessage('Handles inserted and localization files updated successfully.');
} else {
console.error('Apply Edit failed:', workspaceEdit);
vscode.window.showErrorMessage('Failed to replace the UUIDs.');
vscode.window.showErrorMessage('Failed to replace the handle.');
}
});

Expand Down Expand Up @@ -171,7 +179,7 @@ async function updateLocaXmlFiles(changes) {
}

const locaFilePattern = new vscode.RelativePattern(workspaceFolder, '**/Localization/**/*.xml');
const locaFiles = await vscode.workspace.findFiles(locaFilePattern, '**/node_modules/**');
const locaFiles = await vscode.workspace.findFiles(locaFilePattern);
if (locaFiles.length === 0) {
vscode.window.showWarningMessage(`No .xml files found under Localization/. You can create one with the 'Create BG3 File' command.`, 'Create BG3 File').then(selection => {
if (selection === 'Create BG3 File') {
Expand Down
2 changes: 1 addition & 1 deletion commands/packMod.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const packModCommand = vscode.commands.registerCommand('bg3-mod-helper.packMod',
const modsDirPath = path.join(rootModPath, "Mods");
const metaPath = path.join(modsDirPath, modName, "meta.lsx");

// Check if BG3 is running
// Check if BG3 is running might not need anymore i cant rememebr
const isRunning = await isGameRunning();

if (isRunning) {
Expand Down
19 changes: 14 additions & 5 deletions commands/symlinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ const symlinkCommand = vscode.commands.registerCommand('bg3-mod-helper.symlinker

// Handle localization directories
const localizationPath = path.join(rootModPath, 'Localization');
const locDirectories = fs.readdirSync(localizationPath, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
const locDirectories = fs.existsSync(localizationPath)
? fs.readdirSync(localizationPath, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)
: [];

const selectedLocDirs = await vscode.window.showQuickPick(locDirectories, {
canPickMany: true,
Expand All @@ -47,7 +49,7 @@ const symlinkCommand = vscode.commands.registerCommand('bg3-mod-helper.symlinker

console.log("Paths to create symlinks for:", paths);

let anyExists = Object.values(paths).some(p => fs.existsSync(p));
let anyExists = Object.values(paths).some(p => fs.existsSync(p) && !p.includes('GustavDev'));

if (anyExists) {
const response = await vscode.window.showWarningMessage(
Expand All @@ -59,7 +61,7 @@ const symlinkCommand = vscode.commands.registerCommand('bg3-mod-helper.symlinker
return;
} else if (response === 'Remove All' || response === 'Replace All') {
Object.values(paths).forEach(p => {
if (fs.existsSync(p)) {
if (fs.existsSync(p) && !p.includes('GustavDev')) {
console.log("Removing existing path:", p);
fs.rmdirSync(p, { recursive: true });
}
Expand All @@ -81,6 +83,13 @@ const symlinkCommand = vscode.commands.registerCommand('bg3-mod-helper.symlinker
} catch (error) {
vscode.window.showErrorMessage(`Failed to create symlinks: ${error.message}`);
}

// Special handling for the GustavDev folder
const modsPath = path.join(rootModPath, 'Mods');
const gustavDevPath = path.join(modsPath, 'GustavDev');
if (fs.existsSync(gustavDevPath)) {
console.log("Ignoring GustavDev folder in Mods directory.");
}
});

module.exports = symlinkCommand;
2 changes: 1 addition & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function aSimpleDataProvider() {
} else if (element.id === 'formatting') {
return Promise.resolve([
{ label: 'Organize Data Files (Alphabetically)', command: 'bg3-mod-helper.organizeDataFilesCommand' },
{ label: 'Mass Indent LSX Files', command: 'bg3-mod-helper.indentXmlFilesCommand'}
{ label: 'Mass Indent LSX Files (Not working)', command: 'bg3-mod-helper.indentXmlFilesCommand'}
]);
} else if (element.id === 'config') {
return Promise.resolve([
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "bg3_mod_helper",
"publisher": "ghostboats",
"description": "This extension is designed to help you make mods in Baldur's Gate 3 by creating UUIDs and handles for you, as well as updating your .loca.xml files as well should they exist. And more to come in the future.",
"version": "2.2.53",
"version": "2.2.55",
"icon": "media/marketplace_icon.png",
"engines": {
"vscode": "^1.86.0"
Expand Down Expand Up @@ -271,7 +271,7 @@
},
"bg3ModHelper.excludedFiles": {
"type": "array",
"description": "List of files to exclude from conversion. You can quick add items to this via right click on a file in the file tree -> Add to Conversion Exclusion List. Example: [c:/path/to/ur/file.lsx]",
"description": "When you pack a mod, the bg3 mod helper will autoconvert your lsx and xml files. If you wish to exclude an lxs/xml for some reason from auto convertin, add it to the list below. You can quick add items to this via right click on a file in the file tree -> Add to Conversion Exclusion List. Example: [c:/path/to/ur/file.lsx]",
"default": [],
"items": {
"type": "string"
Expand All @@ -295,7 +295,7 @@
"bg3ModHelper.excludeHidden": {
"type": "boolean",
"default": true,
"description": "If, when packing mods, files and folders starting with a '.' should be excluded, ie the '.vscode' folder or a .gitignore file."
"description": "If, when packing mods, files and folders starting with a '.' should be excluded, ie the '.vscode' folder or a .gitignore file (not enabled atm)."
}
}
},
Expand Down
36 changes: 25 additions & 11 deletions support_files/release_notes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const vscode = require('vscode');

const showAlways = true; // Keep this false on release
const showAlways = false // Keep this false on release

function checkForUpdates(context) {
const extensionId = 'ghostboats.bg3-mod-helper';
Expand Down Expand Up @@ -59,17 +59,16 @@ function generateReleaseNotes(version) {
{
title: "Release Page Created",
details: [
"On launch of newly downloaded version of extension, launch release notes page showing newest updates, like this one :)",
"Removed debug toggle that shows this on all launches (todo)"
"On launch of newly downloaded version of extension, launch release notes page showing newest updates, like this one :)"
]
},
{
title: "Mod Setting Changes [IMPORTANT]",
details: [
"Modname Setting Added. This value should be autoset on launch as long as you only have one folder in your rootmodpath's Mods folder. If you have multiple it will need to be set!",
"Configuration Options Data Provider complete, see below",
"Conversion exclusion list UI changes to show difference between this and packing exclusion list (todo)",
"Exclude Hidden (implemented but requires new lslib which is unreleased atm) setting added, possible remove as setting and make it always check files for .(todo)",
"Conversion exclusion list UI changes to show difference between this and packing exclusion list",
"Exclude Hidden (implemented but requires new lslib which is unreleased atm) setting added, possible remove as setting and make it always check files for .",
"Auto Launch Game and Zip options removed as settings. This is now handled via the dropdown data provider, the 'Pack and Play' and 'Pack and Zip' options respectivly.",
"Remove hover enabled setting to remvoe dead setting"
]
Expand All @@ -86,13 +85,16 @@ function generateReleaseNotes(version) {
{
title: "Code Organization via Data Provider",
details: [
"Allows sorting of data files alphabetically (entries and/or their data values as well, user's choice)",
"Allows sorting of data files alphabetically (data values sorted for entries, not sorting the entries themselves but that will be added in the future)",
"LSX tab formatting (todo)"
]
},
{
title: "Symlink Fixes",
details: ["Symlink will no longer create 'random' folders when linking/unlinking (seems to be working, will leave in development tag for now while users test. No errors when personally testing, please send paths/screenshots/info/etc if you have any issues)"]
details: [
"SYMLINKER DISABLED DUE TO CATASTROPHIC FAILURE. IF YOU USED IT BEFORE WITHOUT PROBLEMS, LET ME KNOW AND I CAN GIVE A VERSION THAT HAS IT ENABLED.",
"Symlink will no longer create 'random' folders when linking/unlinking (seems to be working, will leave in development tag for now while users test. No errors when personally testing, please send paths/screenshots/info/etc if you have any issues)"
]
},
{
title: "Zipping Fixes",
Expand All @@ -104,7 +106,7 @@ function generateReleaseNotes(version) {
{
title: "BBCode/Markdown Previewer Added",
details: [
"Test out how your mod page will look using a built-in BBCode/Markdown previewer via the Data Provider (need to add finishing touches) (todo)"
"Test out how your mod page will look using a built-in BBCode/Markdown previewer via the Data Provider (needs more work)"
]
},
{
Expand All @@ -113,10 +115,22 @@ function generateReleaseNotes(version) {
"Extension confirmed to work on Linux (ty satan!)",
"Check if game is lauched for linus in packing(todo)",
"Shortcut to PlayerProfiles Folder added in folder shortcuts",
"Atlas Fix if .lsx file doenst exist yet (todo)",
"Generate and Replace Handle option added when highlighting a handle and rightclicking"
"Atlas Fix if .lsx file doenst exist yet",
"Generate and Replace Handle option added when highlighting a handle and rightclicking",
"Generate Handle will now correctly save the xml files it adds it to",
"Disable button (scrapped, vscode doesnt have a way to disable via api i guess?)"
]
}
},
{
title: "Rollback Instructions",
details: [
"If you encounter any issues with this update, you can roll back to a previous version of the extension by following these steps:",
"1. Open the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing `Ctrl+Shift+X`.",
"2. Search for 'BG3 Mod Helper' in the Extensions view.",
"3. Click the gear icon next to 'BG3 Mod Helper' and select 'Install Another Version...'.",
"4. Choose the previous version from the list to revert to that version."
]
},
]
}
];
Expand Down

0 comments on commit 95b2492

Please sign in to comment.