How to set a relative path in a Generic Test's(Visual Studio 2010) working directory and summary results file - visual-studio-2010

How to set a relative path in a Generic Test's(Visual Studio 2010) working directory and summary results file ?
As far I looked there is no way to set these locations programmatically in Generic test because the generic test has only properties page and no page to write C# code.
I have a folder structure as follows
c:\Files\GenericTestFolder\generictest.sln
c:\Files\SummaryFiles\summary.xml
Now I need to set the working directory to the following (To run an external program)
c:\Files\
And the Summary Results file location to:
c:\Files\SummaryFiles\summary.xml
I tried the following options to set the location of working directory(WD) and summary file(SF) location :
setting WD to "..\" or ".\" or "\" -> all of these seem to set the directory to c:\, so this is not useful for me.
Using a visual studio's inbuilt environment variable like %TestDeploymentDirectory% don't seem to work with "..\" , i.e %TestDeploymentDirectory% ..\ does not translate to parent of %TestDeploymentDirectory% during runtime.

You can use %TestLocation%. Which represents the location of the .GenericTest file.
Source

Related

vscode debugger configuration: cwd

I'm trying to configure a debugger for my project.
Here is the problem.
The project folder structure can be simplified like this:
- Project Root
- X
- Y
- etc
I absolutely need to set the cwd in the debugger config as X, otherwise the binary won't run. If I set it as X, program runs, debugger (sort of) works: I see the call stack and the values of the variables. However, vscode cannot find the files with code and I can't see the lines being executed. VSCode also gives me an error:
Unable to open 'file.cpp':
Unable to read file '/blahblah/cwd/Y/file.cpp'
Error: unable to resolve non-existing file.
So the debugger rightfully uses the cwd as a prefix to the rest of the file path, but Y is not nested into X, it is actually in the same root directory.
Again, I absolutely need the binary to be called from the X directory. Is there any way to tell vscode the proper path to the code files in this case?
So here is what worked for me:
// added this to launch.json
"sourceFileMap: {
"proc/self/cwd" : "{workspaceFolder}"
}
From the VSCode docs:
sourceFileMap:
This allows mapping of the compile-time paths for source
to local source locations. It is an object of key/value pairs and will
resolve the first string-matched path. (example: "sourceFileMap": {
"/mnt/c": "c:\" } will map any path returned by the debugger that
begins with /mnt/c and convert it to c:\. You can have multiple
mappings in the object but they will be handled in the order
provided.)
My problem was that the directory from which I needed the process to run didn't match the directory where the source files are located. In the error message vscode gave me I saw the path it uses to try to find source files ("/proc/self/cwd"). So I mapped this path to the one I actually need (just the workspaceFolder in my case).

Where does Steam store library directories?

In Steam, we can configure multiple directories/folders where it will look for applications. It is found in the menu Steam->Settings->Downloads->STEAM LIBRARY FOLDERS dialog.
Where can I find those settings if I'm looking programatically from outside Steam?
I'm more interested in the location for the Windows client.
Found it. On Windows they are stored in C:\Program Files (x86)\Steam\SteamApps\libraryfolders.vdf, and you also have to add Steam's install folder C:\Program Files (x86)\Steam
Here's a sample Python script to extract the information:
import re
with open(r"C:\Program Files (x86)\Steam\SteamApps\libraryfolders.vdf") as f:
folders = [r"C:\Program Files (x86)\Steam"]
lf = f.read()
folders.extend([fn.replace("\\\\", "\\") for fn in
re.findall('^\s*"\d*"\s*"([^"]*)"', lf, re.MULTILINE)])
I found it here:
C:\Program Files (x86)\Steam\config\config.vdf
There's a line in that file:
"BaseInstallFolder_1" "{YourSteamLibraryFolder}"
So I just open it with Notepad then Ctrl+F search 'Base'.
If that line is not in there:
Open Steam. > Sign into you account. > 'Steam'. > 'Settings'.
Then click on 'Downloads'. > 'STEAM LIBRARY FOLDERS'.
Make an empty folder somewhere.
Click on 'ADD LIBRARY FOLDER'.
Browse to the empty folder you made. > Click on 'SELECT'.
If you then look at the config.vdf again; there should be a line like this:
"BaseInstallFolder_1" "{YourNewEmptySteamLibraryFolder}"
If Steam hasn't been installed in the default location in Windows, you can find it in the registry under HKEY_LOCAL_MACHINE, on path SOFTWARE\Wow6432Node\Valve\Steam. Here's how I found it in Kotlin:
private val steamFolder: File = File(WinRegistry.getString(
WinRegistry.HKEY_LOCAL_MACHINE,
"SOFTWARE\\Wow6432Node\\Valve\\Steam",
"InstallPath"))
You can then find the libraryfolders.vdf and config.vdf files, as per the other answers.
In each of those library folders you'll find files called appmanifest_<id>.acf, where <id> is the id of the game (find it in Properties / Updates on Steam). If you're looking for a particular game, that will help to determine which folder the game is in, if there's more than one game install location.

Front end and back end not compatible - get more linker information

while building a project in VisualStudio 2012 I get the error message
LINK : fatal error C1905: Front end and back end not compatible (must target same processor).
Checking the project manually does not help, all involved (static) libraries have been built for the same processor. I also added
/VERBOSE:lib and /VERBOSE
to command line to get some more information but this does not help, only additional output line I got by this was a stupid
Starting pass 1
So: any ideas how I can find out what causes this strange error message? How can I get more output from the linker?
Thanks!
Old question and I'm not sure whether anyone still need an answer. I had this problem with Visual Studio 2017.
Check paths for generated .obj files, especially when you use some .cpp files in more than one project (within solution) and/or use %(RelativeDir) variable in Properties -> C/C++ -> Output Files -> Object File Name. It happened to me with this path in Object File Name '$(IntDir)\%(RelativeDir)' and this $(ProjectDir)Junk\$(Platform)\ in Intermediate Directory. Error gone when I moved $(Platform) part to Object File Name.
Old paths:
Intermediate Directory: $(ProjectDir)Junk\$(Platform)\.
Object File Name: $(IntDir)\%(RelativeDir).
New paths:
Intermediate Directory: $(ProjectDir)Junk\.
Object File Name: $(IntDir)$(Platform)\%(RelativeDir).
You can also specify Object File Name option for each file, shared between multiple projects to keep using old path (or if new paths configuration isn't working for you) and get rid of that error.

Images Disappear in Running Status on Qt

Original design :
Setting in property :
When the program is running :
All the image inside the project folder "QuickRecorder/Images/MainWindow".
How to solve this problem?
Thank you for your help.
In cases like this the reason almost always is: You use relative path to the image, and the working directory is different when you run the application, and image is not found by the relative path.
To debug, add this to your main to print current working directory:
qDebug() << QDir::currentPath();
A few solutions:
Use absolute paths (preferably so that you construct them at runtime, for example using QCoreApplication::applicationDirPath(), instead of hard-coding).
Put images to Qt resources, so they are embedded to the executable.
Change working directory after application starts (might have unintended consequences if you for example launch child processes, or with file open/save dialogs).
Untested, moved from comment to answer: To automatically copy files from the source dir to the build dir, you could add a build step "Custom Process Step" in the Qt Creator project settings. The command you might want to use for the case of this question might be (again, untested):
cp -rv %{sourceDir}/QuickRecorder %{buildDir}

WiX can'f find my file : unable to load file, error LGHT0103

I am using WiX 3.5 and making an installer. I have used heat.exe to bundle all the files.
It produced a WiX file. I referred in main wxs files as componentgroup ref. When I build my installer, it throws the following exception.
light.exe : error LGHT0103 : The system cannot find the file
'..........\target\tmp-release\jboss-eap-5.0\jboss-as\server\all\deploy\httpha-invoker.sar\invoker.war\WEB-INF\classes\org\jboss\invocation\http\servlet\ReadOnlyAccessFilter.class'
with type ''.
It is able load many files from this location, except the above file, even though the file is present.
Looks like you've hit the linker bug. As far as I can see, it was already reported to the WiX team, and was scheduled for v4.0. The comment to the issue states the path is more than 255 characters, so a possible workaround for you is to re-work the files/folders layout to avoid the paths of that length.
Hope this helps.
The answer of Ravz1234 works ! I used it with a environment variable e.g. env.SourcePath.
1) Set an environment variable to show on your Source Dir e.g. C:\SourceDir
2) On heat.exe add the argument -var env.SourcePath along with the other arguments
I used the variable for the directory, sys.SOURCEFILEDIR, and it worked well.

Resources