Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Windows Subsystem for Linux #21

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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
19 changes: 18 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@

const path = require ("path");
const os = require("os");
const child_process = require('child_process');

const home = os.homedir();
let home = os.homedir();
if (os.platform() === 'linux') {
try {
const username = child_process.execSync("powershell.exe '$env:UserName'").toString().trim();

if (username) {
home = '/mnt/c/Users/' + username + '/';
}
} catch (e) {
// Not a WSL machine
}
}

module.exports = {
FOLDERS: {
Expand All @@ -26,6 +38,11 @@ module.exports = {
"p": path.join(home, "Library", "Application Support", "Adobe", "Adobe XD (Prerelease)"),
"d": path.join(home, "Library", "Application Support", "Adobe", "Adobe XD (Dev)")
},
"wsl": {
"r": path.join(home, "AppData", "Local", "Packages", "Adobe.CC.XD_adky2gkssdxte", "LocalState"),
"p": path.join(home, "AppData", "Local", "Packages", "Adobe.CC.XD.Prerelease_adky2gkssdxte", "LocalState"),
"d": path.join(home, "AppData", "Local", "Packages", "Adobe.CC.XD.Dev_adky2gkssdxte", "LocalState")
},
"win": {
"r": path.join(home, "AppData", "Local", "Packages", "Adobe.CC.XD_adky2gkssdxte", "LocalState"),
"p": path.join(home, "AppData", "Local", "Packages", "Adobe.CC.XD.Prerelease_adky2gkssdxte", "LocalState"),
Expand Down
7 changes: 6 additions & 1 deletion lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@
*/

const process = require("process");
const os = require("os");

let platform;
let platform = null;
switch(process.platform) {
case "darwin":
platform = "mac";
break;
case "win32":
platform = "win";
break;
case "linux":
if (os.release().toLowerCase().includes("microsoft"))
platform = "wsl";
break;
default:
platform = null;
}
Expand Down