define relative path instead of absolute paths in Visual Basic - relative-path

could someone please help me with how to define relative paths instead of absolute in VB? Or how to declare them in code?
As example:. **../** oder **~/**
In order to run an .exe after giving the relative paths in script.

Related

How can I find all references of a variable in bootstrap sass folder using Visual Studio Code?

I have opened the Bootstrap SCSS folder in Visual Studio Code and I'm trying to find all of references of a variable (for example: $display) in the whole files in that folder and its sub folders, but when I actually do that it seems like VSC only searches the file that variable has been defined there and it's not showing me all the references. How can I achieve that? Or am I doing something wrong?
On the bar left there is the magnify glass search tab. Use that search and it should pull up all the occurrences of that variable in other files also.

Embedding an image as a resource in a FireBreath plugin

While using VS (2010), I used to be able to add an image as a resource simply by going to the Resource view and then: Right click project > Add > Resource > Import.
I even asked a question about how to then load it: Loading an image from a resource embedded in a dll, but that changed for some reason.
Now when I try the same thing and save the .rc file, I get this message:
"The resource script FILE_PATH.rc was not created using Microsoft
Visual Studio. Comments, macros, preprocessor directives, and
conditionally included information may be modified and/or removed from
this file during the build process. Replace existing file?"
Even if I click "yes" (in order to just test things) then I get all kind of error messages at compile time:
ResourceCompile:
gen\firebreathWin.rc(8): error RC2144: PRIMARY
LANGUAGE ID not a number
gen\firebreathWin.rc(16): error RC2135: file not found VS_VERSION_INFO
etc...
I have two questions:
What is the correct way to add an image resource which will be added to the compiled plugin using CMake? I searched about it and couldn't find any helping information.
What can be the cause for this change in behavior? since I was able to use the same exact steps before and it worked.
Thanks.
First of all, I wouldn't do this; instead, I'd just put the file in the same directory as your DLL and use the path of DLL to find it.
That said, the "correct" way to do this would be to see what changes are made to the .rc file when you add it in the IDE, copy the .rc file from gen_templates/ in the root of the firebreath directory into your project, and then make those changes to your copy of the file. Any changes you make to the generated file will be overridden any time cmake is run again, which can happen any time your cmake files (CMakeLists.txt, *.cmake) change.

Open a specific file in vb.net

I want my program to open a specific .txt file. The text file will always stay in the same folder within the solution folder. However, the location of the solution folder itself may change if the solution is moved to a different computer, or a different directory on the current computer.
I know how to hardcode the file path append the file name and then open it. But how can I define the file path so that the file can still be opened if the solution moves to a different computer?
If the file is contained within the solution, you can use a virtual path which is then mapped to a physical path using Server.MapPath
The following should work :
Dim filePath As String = Server.MapPath("~/FileName.txt")
Please note that the location of FileName.txt in my example is in the root of the solution and not in any specified folders, ~/ is essentially the root of the current solution.
For more information on the Server.MapPath method and Virtual Paths see below:
Server.MapPath MSDN Documentation
Virtual Path Utility Class
If you are sure that your application (.exe) and (.txt) files are in the same folder, then just use the file name - do not put the path.
IO.File.OpenText("thefile.txt")
Edited:
Mostly "current working directory" is the same directory where the (.exe) file exists. Yes, sometimes, it is not the same directory. Thus, Application.ExecutablePath would be the right solution.
Dim fn As String
fn = Application.ExecutablePath.Remove(Application.ExecutablePath.LastIndexOf("\")+1) & "thefile.txt"
IO.File.OpenText("thefile.txt")
...
If you meant to say your FileName.txt was always present in the same directory as the assembly, you could do something simple like this:
Function GetAssemblyDirectoryPath() As String
Dim fullAssemblyPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Return fullAssemblyPath.Substring(0, fullAssemblyPath.LastIndexOf("\"c))
End Function
This just returns the path to the folder where the assembly resides. The "Solution" might not always be present, but the assembly will, so this will work in both cases (if you make sure the file is always copied to the output directory).
If you're asking about a desktop application, application.ExecutablePath will do what you want. It's not really a good idea though, if your application will reside within Program Files - it's best to avoid writing to anywhere within there, and you will have to run as administrator on post-XP OS's .

Setting string intentions to filepath

I love intelliLang in jetbrains, but one thing I would like to know is what option do I choose to make it see my intention as a file path.
For example, you can change intention from css and scss and the like. How do you give it the intention that, this is a file path?

Passing files selected in project views to external tools

Is it possible to pass paths to all files currently selected in the project view to an external tool?
I know you can use the $FilePath$ macro but it only seems to pass the path to the first selected file ignoring the rest and no other macro seems suitable. A workaround would also be using all the files from the parent directory, but that's not feasible in my case.
It's not possible right now, please vote for this feature request.