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

fix: all user configuration data now lives in Ganache/ui #5250

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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