Vscode open file with "ctrl-click" with relative paths - visual-studio-code

I have a .yaml file that has a key value pair, the value being a string with a note saying see <filepath>.yaml
I want to be able to "ctrl-click" on the file to open it, and this works with absolute paths e.g.: See file:///c:/dev/<rest of path>/<file>.yaml
Is this possible with relative paths? How is vscode treating the root folder? Can I set a root folder for file:/// to look for first?

Related

vscode: Where stores the session data (restored opened files)? Is that possible to use relative path?

If I use vscode to open a directory and then opened some files and quit, vscode will reopen all the files at the next time when it launches.
But there is a problem. It seems vscode is not using relative path for storing this info and does not store this info inside the project directory. So if I move the directory or rename it, and then open the directory again, for example code projectNewName/, my previous session (opened files/opened editors) are lost. I have no idea where this session data stores and if it is possible to configure it to store relative path and save the session file inside the project directory, for example, project/.vscode or project/.vscode/session. If the opened editors session is stored inside a project directory, it will be restored regardless where the directory is and what the directory name is.
TL;DR: currently, configuration of this path is not supported.
VSCode stores the states for all the workspaces, in its global config folder under /Code/User/workspaceStorage/. See the path to the settings.json in this help paragraph for your OS and then just replace the end of the path. For Windows, for example, the settings path is %APPDATA%\Code\User\settings.json, so the state storage is
%APPDATA%/Code/User/workspaceStorage/
In this directory, there are many subdirectories with some hex names. Please, refer to my another answer for a python script to browse it. Each folder contains a workspace.json with mostly data only referring to the path of the workspace. There are also state.vscdb files in these directories. These are sqlite databases with only one table:
CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB);
It is used as a key|value storage for all the state variables like:
workbench.panel.output|{"workbench.panel.output":{"collapsed":false,"isHidden":true}}
As far as I see from VSCode source, currently only a global path from the environment is used to locate this file:
this.environmentService.workspaceStorageHome
this.environmentService.globalStorageHome
which resolves to
get workspaceStorageHome(): URI { return URI.joinPath(this.appSettingsHome, 'workspaceStorage'); }
get globalStorageHome(): URI { return URI.joinPath(this.appSettingsHome, 'globalStorage'); }
So, it seems there are currently no options to customize it from the settings.json.

How to copy file from applicationStorageDirectory into dataDirectory?

I would like to copy an image file located in www/assets/imgs/christmas.jpg to the dataDirectory folder using the Ionic Native File Plugin, however I don't know how to access the www folder. I tried the following:
this.file.checkFile(this.file.applicationStorageDirectory, 'assets/imgs/christmas.jpg')
But it always returns NOT_FOUND_ERR.
You should change applicationStorageDirectory to applicationDirectory (although I am not sure what the difference is) and add www in front of the file path as the application directory contains the www folder and not its contents. So instead of assets/imgs/christmas.jpg use www/assets/imgs/christmas.jpg

How to specify path in .config file relative path to folder?

I have folder "NuGetPackages". I need to access only the folder on my computer is OK but on server is different folder structure where the project is store
what i use on my computer absolute path:
C:\workspace\HUD\02_Development\04_Tools\NuGetServer\NuGetPackages
What should I write in the config file to make sure the path is ..\NuGetPackages expanded relative to the config file rather the working?
directory?
I can't change the app I can only change the config file.
I have also try "~/NuGetPackages" but didn't work.
In short, you can't do exactly what you're trying to do.
If you can't change any of the code, your only real option is to use config transforms. You can have your *.Debug.config use your local path, and then your *.Release.config (or whatever your published build configuration is), and use the server's path.
Here are some docs on doing config transforms: https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx

To delete a file, located in the search path, in MATLAB

I have a file located in /path/to/Matlab/myData.mat. The path /path/to/Matlab has been in the search path. I launch Matlab from /path/to/Matlab/workspace/.
However, the command if (exist('myData.mat','file')==2) delete('myData.mat'); returns error saying that File myData.mat cannot be found.
There is only one file named myData.mat among all the search paths. Is it mandatory to use absolute or relative path when call the delete() function providing the location has been added to the search path?
My OS is Ubuntu 16, and Matlab v2015b.
Use which to find the full path

What is "." in matlab search path?

I'm trying to set up the search path of my laptop matlab. I saw "." in my office computer matlab(set up by someone else).
What does . mean?
How can I add . also as my search path. I tried to add it but it failed.
There are two methods for specifying paths: absolute and relative paths.
An absolute path is e.g. C:\some\folder in Windows, or e.g./Some/folder in Linux and Mac. As the name says, these are absolute and always the same. Relative paths however are paths specified in relation to the current working directory.
When creating relative paths, . is the current working directory. .. similarly is the parent directory. This can be used to add subfolders to the path, e.g. ./subfolder or add another directory which in located in the parent directory, e.g. ../other_directory.
Afaik, you don't need to add the current working directory to the search path, as this is the default behavior of MATLAB.