Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into release/desktop-io…
Browse files Browse the repository at this point in the history
…ta-2.0.9
  • Loading branch information
begonaalvarezd committed Mar 7, 2024
2 parents 653417a + 6ea1801 commit 96ad9b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/desktop/electron/electronApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ const ElectronApi = {
updateAppSettings(settings) {
return ipcRenderer.invoke('update-app-settings', settings)
},
async renameProfileFolder(oldPath, newPath) {
return ipcRenderer.invoke('get-path', 'userData').then((userDataPath) => {
if (oldPath.startsWith(userDataPath)) {
try {
fs.renameSync(oldPath, newPath)
} catch (err) {
console.error(err)
}
}
})
},
async removeProfileFolder(profilePath) {
return ipcRenderer.invoke('get-path', 'userData').then((userDataPath) => {
// Check that the removing profile path matches the user data path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IPlatform {
updateAppSettings(settings: Partial<IAppSettings>): Promise<void>
updateActiveProfile(id: string): void
removeProfileFolder(profilePath: string): Promise<void>
renameProfileFolder(oldPath: string, newPath: string): Promise<void>
listProfileFolders(profileStoragePath: string): Promise<string[]>
updateMenu(attribute: string, value: unknown): void
popupMenu(): void
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/lib/tests/__mocks__/platform.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const Platform: IPlatform = {
removeProfileFolder(profilePath: string): Promise<void> {
return Promise.resolve(undefined)
},
renameProfileFolder(oldPath: string, newPath: string): Promise<void> {
return Promise.resolve(undefined)
},
saveRecoveryKit(kitData: ArrayBuffer): Promise<void> {
return Promise.resolve(undefined)
},
Expand Down

0 comments on commit 96ad9b1

Please sign in to comment.