Is there a way to change the default paths for visualstudiocode? - visual-studio-code

Settings, plugins are held in these predefined locations, for example on Windows it's
%APPDATA%\Code\
It is possible to override this path and maybe set it relative to the installation or working directory?
Thank you for any answers.

Just as a reference if someone finds this issue again:
There is a command line option to set the data folder: --user-data-dir <dir>
https://code.visualstudio.com/docs/editor/command-line#_advanced-cli-options

VS Code supports Portable Mode, which will keep data in folders local to the installation.
You can refer to the documentation here for how to configure it.

Related

How to reference in settings a path to subdirectory within VSCode portable (relative to 'Code.exe')?

I'd appreciate your help.
According to VSCode Variables Reference, I was expecting something like this to work:
${execPath}\data_cadu
Nonetheless, ${execPath} didn't work.
How to set up path to subdirectory within VSCode portable for Windows (relative to 'Code.exe')?
The screenshot below details further the path I'm trying to set within VSCode settings.
Thank you!
In the described context, the path to a subdirectory is related to an extension that wasn't recognizing ${execPath}. I contacted the extension developer, who provided a clarifying answer:
in this case I simply replace ${execPath} with the return value of the process.exePath.
Thus your desired path should be:
${execPath}\..\data_cadu
Note extra .. as exePath is not the dir but the exe file.
I already tested the path `${execPath}..' with other extensions, which have recognized it.
This reply is also aligned to another thread about using powershell within VSCode portable subdirectory, who reported that ${execPath}\..\ worked properly.

Overriding extensions directory in vscode

One can specify the extension dir by running from command line:
code --extensions-dir c:\path\to\ext
However, I would like to set this parameter even when running from the windows menu.
I tried to modify the argv.json file located in the .vscode folder (like for https://code.visualstudio.com/docs/getstarted/locales).
It didn't work.
Does anybody know how to fix this?
Bests
Try creating an environment variable called VSCODE_EXTENSIONS with the value of c:\path\to\ext
As a complement to DG's response
If the VSCODE_EXTENSIONS environment variable is created as a system variable, it seems to affect all users.
In my case, I performed the following steps:
close VSCode on all users (I usually have one session open as
administrator and another as non-administrator)
set the variable VSCODE_EXTENSIONS = c:\ProgramData\Code\extensions\
moved all extensions from the extensions folder of the administrator to c:\ProgramData\Code\extensions\
restart the computer
log in with both users and the extensions were available
It is convenient to mention since then the extensions installed by administrator are available to all users and are installed in the folder mentioned previously.

How to set virtualenv to another directory?

I had a problem come up when I was forced to change my project directory name.
First Virtualenvwrapper didn't see my projects, so I changed the environment variable of WORKON_HOME to the new project directory. I could then activate my envs. But now when my project is doing anything, it thinks it's in the old directory, not the new one. I can't figure out how to change this. I've looked in the reference material, and looked for the place that actually points to where the projects are, but I had no luck with either. Please help.
It sounds like you want to set an already-created virtual environment to a directory that contains your project. One way that I am familiar with to do the following, based on the virtualenvwrapper documentation.
Activate your desired virtual env
workon myvirtualenv
Change your directory to your desired project directory
$ cd my/project/dir
Set your virtualenv project to the current directory
$ setvirtualenvproject
The default is to use the current directory. The full syntax is:
$ setvirtualenvproject [virtualenv_path project_path]
I hope this helps!

Specifying relative paths in SPSS 18

In SPSS 11 it was possible to specify relative paths. Example:
FILE HANDLE myfile='..\..\data\current.txt' /LRECL=533.
DATA LIST FILE=myfile /
...
This worked because apparently, SPSS 11 set the working folder to the path where the source .SPS file is saved. It seems that SPSS 18 always sets it's working folder to the installation folder of SPSS itself. Which is not at all the same thing.
Is there an option to change this behaviour? Or am I stuck with changing everything to absolute filenames?
Instead of a relative path, you could define a directory path and use it inside other file handle declarations to save typing:
FILE HANDLE directoryPath /NAME='C:\Directory\Path\' .
FILE HANDLE myFile /NAME='directoryPath/fileName.xyz' .
GET FILE='myFile' .
This will get the file: C:\Directory\Path\fileName.xyz.
The direction of the slashes may be important.
(Works in version 17)
If you use the INSERT command to run an sps file, it has an option to change the working directory to that location.
You could use the HOST command to SUBST a drive letter (on PCs) and reference everything through that.
You could define a FILE HANDLE to the common root location and use that in file references.
You could use Python programmability to find the path to the active syntax window and issue an SPSS CD command to set the backend working directory appropriately.
HTH,
Jon Peck
With Python, you can get the full path of the current syntax window (or any other one) and get its path. Using that you can issue an SPSS cd command to change the backend working directory accordingly.
If you define an environment variable, though, you can use that in file specifications within SPSS.
p.s. SPSS has an extensive set of apis and helper modules for Python (as well as for R and .NET languages). You can get information about this from SPSS Developer Central, www.spss.com/devcentral. All the language extensions are free once you have the base SPSS Statistics product.
Regards,
Jon Peck
Or use "CD" command to change your default working directory. See also:
http://www.spss-tutorials.com/change-your-working-directory/
For example, if your default directory is C:\project, then GET FILE 'data\data_file.sav'. will open data_file.sav from C:\project\data.
And then, a few minutes later, i came across this little python script from jignesh-sutar (see here: SPSS syntax - use path of the file.
With his python code you can use the path of the syntax file as starting point for all the paths in your syntax.

How to change the location of the netbeans settings directory (~/.netbeans)

By default netbeans stores it's settings in a directory called .netbeans under the user's home directory. Is it possible to change the location of this directory (especially under Windows)?
Thanks to James Schek I now know the answer (change the path in netbeans.conf) but that leads me to another question:
Is there a way to include the current username in the path to the netbeans setting directory?
I want to do something like this:
netbeans_default_userdir="D:\etc\${USERNAME}\.netbeans\6.5beta"
but I can't figure out the name of the variable to use (if there's any).
Of course I can achieve the same thing with the --userdir option, I'm just curious.
yes, edit the netbeans.conf file under %NETBEANS_HOME%\etc.
Edit the line with:
netbeans_default_userdir="${HOME}/.netbeans/6.0"
If you need different "profiles"--i.e. want to run different copies of Netbeans with different home directories, you can pass a new home directory to the launcher. Run "netbeans.exe --userdir /path/to/dir" or "nb.exe --userdir /path/to/dir"
"HOME" is the only variable supported by the IDE. When deploying a custom application using the Netbeans Platform, "APPNAME" is also supported out of the box.
For someone who lands up here hunting for an answer:
If you are trying to setup a portable version in windows, Netbeans 7.2 and up wont start if userdir is at the same level or lower than the Netbeans root.
So if you have:
c:\Portable\Netbeans you can NOT do netbeans_default_userdir="c:\Portable\Netbeans\userdir\8.0"
Use a folder OUTSIDE netbeans installation e.g.
netbeans_default_userdir="c:\Portable\NetbeansUserDir\8.0"
for cache it does not matter.
Tested in Windows 8.1 and 7.