Skip to content

Need Env Variables for DataDir and ExtensionDir #49306

Closed

Description

@daviduuang

Currently, we can only get a few env variables when refer to the mannual here.
So other extensions may access the path of extension and data dir in their code like this:

let settingsPath = path.join(process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE, 'commandbar.json');

And we can run vscode with command-line parameters here.

If we specify the following options(for example, we can make it portable), we may change the extension and data dir settings.

--extensions-dir <dir> Set the root path for extensions.
--user-data-dir <dir> Specifies the directory that user data is kept in, useful when running as root.

But other extensions cann't realize the changes, so it may fails. This issue may be solved when env variables of extension-dir and data-dir exposed.


VSCode v1.23.0 x64(on Win10)

Activity

  1. added
    feature-request
    on May 7, 2018
  2. shanalikhan commented on Jul 22, 2018

    @shanalikhan

    I need to support Settings Sync as portable mode.
    It would be great if you guys just expose these paths, currently i'm looking to solution that is not feasible though but will work

  3. tmeckel commented on Nov 22, 2018

    @tmeckel

    Settings sync doesn't still work with VSCode when the --user-data-dir= command line parameter is used.

    Error: ENOENT: no such file or directory, stat 'C:\Users\ee022a6\AppData\Roaming\Code'
    	at fs.statSync (fs.js:954:11)
    	at Object.fs.statSync (ELECTRON_ASAR.js:295:16)
    	at Object.statSync (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\node_modules\graceful-fs\polyfills.js:297:22)
    	at new Environment (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\environmentPath.js:114:24)
    	at Sync.<anonymous> (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\sync.js:32:25)
    	at Generator.next (<anonymous>)
    	at C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\sync.js:7:71
    	at new Promise (<anonymous>)
    	at __awaiter (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\sync.js:3:12)
    	at Sync.bootstrap (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\sync.js:31:16)
    	at C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\extension.js:18:14
    	at Generator.next (<anonymous>)
    	at fulfilled (C:\Users\ee022a6\AppData\Local\Apps\VSCodePortable\Data\extensions\shan.code-settings-sync-3.2.0\out\src\extension.js:4:58)
    	at <anonymous>
  4. jrieken commented on Nov 10, 2020

    @jrieken
    Contributor

    /duplicate of #2741

  5. added
    *duplicate
    on Nov 10, 2020
  6. vscode-triage-bot commented on Nov 10, 2020

    @vscode-triage-bot

    Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

    Happy Coding!

  7. locked and limited conversation to collaborators on Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicateapifeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions