updated window manager to open home

This commit is contained in:
andrei-mihnea-cerbu
2025-02-05 12:39:48 +02:00
parent 39b7150f0a
commit eda2e2d2a0
+4 -2
View File
@@ -1,4 +1,4 @@
import { BrowserWindow, dialog, shell } from 'electron' import {app, BrowserWindow, dialog, shell} from 'electron'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
@@ -61,6 +61,7 @@ export class WindowManager {
async selectDirectory(): Promise<string | undefined> { async selectDirectory(): Promise<string | undefined> {
const result = await dialog.showOpenDialog(this.mainWindow, { const result = await dialog.showOpenDialog(this.mainWindow, {
properties: ['openDirectory'], // Only allow selecting directories properties: ['openDirectory'], // Only allow selecting directories
defaultPath: app.getPath('home')
}) })
if (result.filePaths && result.filePaths.length > 0) { if (result.filePaths && result.filePaths.length > 0) {
@@ -90,8 +91,9 @@ export class WindowManager {
async selectFile(): Promise<string | undefined> { async selectFile(): Promise<string | undefined> {
const result = await dialog.showOpenDialog(this.mainWindow, { const result = await dialog.showOpenDialog(this.mainWindow, {
properties: ['openFile'], // Allow selecting a file properties: ['openFile'], // Allow selecting a file
defaultPath: app.getPath('desktop'),
filters: [ filters: [
{ name: 'All Files', extensions: ['*'] }, // Optionally filter for specific file types { name: 'All Files', extensions: ['*'] },
], ],
}) })