-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Portable mode: VSCODE_PORTABLE not available for uninstall script #54345
Comments
@JimiC Isn't it better to actually get the Why do you need that path, anyway? |
@joaomoreno See: It is needed to delete all configuration files. |
@joaomoreno You see having Then the code would look like this: let userDir: string;
if (process.env.VSCODE_PORTABLE) {
userDir = path.join(process.env.VSCODE_PORTABLE, 'user-data', 'User');
} else {
const appDir = /^win/.test(process.platform)
? process.env,APPDATA
: process.platform === 'darwin'
?`${os.homeDir()}/Library/Application Support`
: process.platform === 'linux'
? `${os.homedir()}/.config`
: '/var/local';
const baseUserDataDir = /dev/i.test(__dirname)
? 'code-oss-dev'
: /oss/i.test(__dirname);
? 'Code - OSS'
: /insiders/i.test(__dirname)
? 'Code - Insiders'
: 'Code';
userDir = path.join(appDir, baseUserDataDir, 'User');
} Now, if we had an |
Get the marble. |
Actually, hold the marble. After discussing with @sandy081, we think you might benefit more from two other options:
This is because our settings files might (and often do) contain comments, which your Closing this for now. |
Having access to |
Well, I sure do hope the hypothetical extension would be using the official |
Ooops. I'll have to explore that |
I see it now. Guilty as charged. Just for the record, I've seen other extensions storing files where they shouldn't too. We are going to adjust our code to use the API instead. And let's hope we will get the API for the uninstall script real soon. |
@JimiC Sweet! |
@joaomoreno After trying to implement settings storage using
Therefore using The offer for the statue still stands. |
cc @sandy081 for insights |
@JimiC You are right, |
Because we want this file to be persistent during a new extension version release. If we are to use |
This #2741 would be the proper solution. |
@sandy081 One other thing is that we support icons customization and we need a persistent location where the user can put their custom icons. These icons should not be removed with every new extension version release. |
I see, not sure if we expose user data directory as an API. @jrieken What location do we recommend authors if they want to store files as global cache? If user data directory is the common usage why not expose it in the extension context? |
There is |
@jrieken We have already ruled out that this path does not suffice (#54345 (comment)). |
@jrieken Can we get an |
That sounds wrong... The |
If this will be persistent across extension updates, yes, please. And we will need this path to be available on |
@jrieken I have solved half my problem by using Now I'm up to solve the other half of my problem, which is where to store user files by default (in our case custom icons) and have access to that via the API. Any recommendations? |
@jrieken 👍 |
Steps to Reproduce:
vscode:uninstall
scriptprocess.env
.process.env.VSCODE_PORTABLE
is missingDoes this issue occur when all extensions are disabled?: Yes
When trying to support
Portable Mode
onvscode-icons
,process.env.VSCODE_PORTABLE
is very handy to determine if thevscode
instance is started in portable mode (thus finding where theuser-data
directory is). Unfortunately the same can not be achieved for the uninstall script.The text was updated successfully, but these errors were encountered: