Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5251 from trufflesuite/develop
Browse files Browse the repository at this point in the history
move all user data into `Ganache/ui` missed from v2.7.0-beta
  • Loading branch information
jeffsmale90 authored Feb 7, 2023
2 parents 846c421 + 539d0d0 commit 1ecda53
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if (isDevelopment) {
app.commandLine.appendSwitch("remote-debugging-port", "9222");
}

const USERDATA_PATH = app.getPath("userData");
const USERDATA_PATH = path.join(app.getPath("userData"), "/ui");
let migrationPromise;

if (process.platform === "win32") {
Expand All @@ -97,7 +97,7 @@ if (process.platform === "win32") {
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "extras")])
})
.then(()=> {
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "ui/workspaces")])
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "workspaces")])
})
.then(()=> {
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "default")])
Expand Down
7 changes: 2 additions & 5 deletions src/main/init/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ let migrate, uninstallOld;
directory. This means that the old workspaces are available to both new and
old versions of Ganache-UI, but new workspaces are only available to new
versions.
The intention is to migrate all Ganache-UI data to the /Ganache/ui directory,
giving the user the option to move (and migrate the chaindata of) legacy
workspaces.
See: https://github.com/trufflesuite/ganache-ui/pull/5151
*/
const linkLegacyWorkspaces = async (configRoot) => {
const legacyWorkspacesDirectory = join(configRoot, "workspaces");
const newWorkspacesDirectory = join(configRoot, "ui/workspaces");
const legacyWorkspacesDirectory = join(configRoot, "../workspaces");
const newWorkspacesDirectory = join(configRoot, "workspaces");

if (!await exists(newWorkspacesDirectory)) {
await mkdir(newWorkspacesDirectory, { recursive: true })
Expand Down
2 changes: 1 addition & 1 deletion src/main/types/workspaces/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Workspace {
return path.join(configDirectory, `default_${flavor}`);
}
} else {
return path.join(configDirectory, "ui/workspaces", sanitizedName);
return path.join(configDirectory, "workspaces", sanitizedName);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/types/workspaces/WorkspaceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WorkspaceManager {
}

enumerateWorkspaces() {
const workspacesDirectory = path.join(this.directory, "ui/workspaces");
const workspacesDirectory = path.join(this.directory, "workspaces");

if (fse.existsSync(workspacesDirectory)) {
this.workspaces = readdirSync(workspacesDirectory, { withFileTypes: true }).flatMap((file) => {
Expand Down

0 comments on commit 1ecda53

Please sign in to comment.