Can we able to get Os Name XD is currently running
Edit
async function checkPlatform() {
const storage = await require("uxp").storage;
const pluginFolder = await storage.localFileSystem.getPluginFolder();
var path = pluginFolder.nativePath;
var result = "";
if (path.startsWith("/Users")) {
result = "mac"
} else if (path.startsWith("C:\\Users")) {
result = "windows";
} else {
result = "this_is_madness";
}
return result;
}
to get platform =>
checkPlatform().then(
result => {
console.log(result);
}
);
it works fine!!!
Just one detail: on Mac the starting tilde means '/Users/username’
So, update the following: if (pluginFolderPath.startsWith("/Users"))
and that’s it.
@kerrishotts is os module in api is an npm module or a custom built by adobe because i want to use process module in npm with present api(different form package.json model) its bit hard to implement
Sorry for the delay here – yes, the documentation is strange here. It’s a quirk of the docs generation process. We’re working on improving this over time.
The os module is behind require('os'), just like you’d do on Node.