@@ -278,15 +278,39 @@ document.getElementById("save-as-btn").addEventListener("click", async function(
278278
279279// Mod Folder
280280document . getElementById ( "select-folder-btn" ) . addEventListener ( "click" , async function ( ) {
281- try {
281+ const currentPath = document . getElementById ( "folder-label" ) . textContent ;
282+ const pathInputId = "folder-path-input" ;
283+
284+ showModal ( "Select Mod Folder" ,
285+ '<div style="display: flex; flex-direction: column; gap: 8px;">' +
286+ '<label for="' + pathInputId + '" style="font-size: 13px; color: var(--text-secondary);">Mod Folder Path</label>' +
287+ '<div style="display: flex; gap: 6px;">' +
288+ '<input type="text" id="' + pathInputId + '" value="' + escapeHtml ( currentPath ) + '" placeholder="/path/to/mods" style="flex: 1; padding: 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-secondary); color: var(--text-primary); font-size: 13px;"/>' +
289+ '<button class="btn" id="browse-folder-btn">Browse</button>' +
290+ '</div>' +
291+ '</div>' ,
292+ '<button class="btn" onclick="closeModal()">Cancel</button>' +
293+ '<button class="btn btn-primary" id="confirm-folder-btn">OK</button>'
294+ ) ;
295+
296+ document . getElementById ( "browse-folder-btn" ) . addEventListener ( "click" , async function ( ) {
282297 const dir = await window . go . main . App . SelectModFolder ( ) ;
283298 if ( dir ) {
284- document . getElementById ( "folder-label" ) . textContent = dir ;
299+ document . getElementById ( pathInputId ) . value = dir ;
300+ }
301+ } ) ;
302+
303+ document . getElementById ( "confirm-folder-btn" ) . addEventListener ( "click" , async function ( ) {
304+ const path = document . getElementById ( pathInputId ) . value . trim ( ) ;
305+ try {
306+ await window . go . main . App . SetModFolderPath ( path ) ;
307+ document . getElementById ( "folder-label" ) . textContent = path ;
308+ closeModal ( ) ;
285309 await updateUI ( ) ;
310+ } catch ( err ) {
311+ await showError ( "Error" , err ) ;
286312 }
287- } catch ( err ) {
288- await showError ( "Error" , err ) ;
289- }
313+ } ) ;
290314} ) ;
291315
292316// Snapshot
0 commit comments