How to specify relative paths in .vsprops file - visual-studio

Is there any way to specify in .vsprops file paths relative to .vsprops file directory?
For example, I have the followind directory stucture:
largesolution.sln
a/a.vcproj
b/c/c.vcproj
common/common.vsprops
Both a.vcproj and c.vcproj include common.vsprops, and I want to add some macro or set include directory relative to common folder regardless the solution directory both projects are included to. I've tried using $(InputDir) in .vsprops file, but it seems this macro is expanded as directory containing .vcproj, not .vsprops file.
Setting absolute paths or setting global include path in Visual C++ Directories is not a solution because different developers have different location of the source tree root. Setting paths relative to $(SolutionDir) does not suit because it is useful to have smaller solutions containig some subset ob projects (for example, a.vcproj only) somewhere outside main sources tree.
Of course, setting include directory in a.vcproj to $(ProjectDir)..\common works fine, but the result to be achieved is only including .vsprops and having paths set correctly.

You can use MSBuildThisFileDirectory macro.
For example:
You set Include Directories to "$(MSBuildThisFileDirectory)\include;$(IncludePath)" in common.props.
See http://msdn.microsoft.com/en-us/library/vstudio/ms164309.aspx for details.
Tested with MSVS2012 and MSVS2013.

Related

knit Rmarkdown moderncv to pdf using makefile with sty file in subdirectory

I am using the moderncv class to create a CV in Rmarkdown. In order to make the cv reproducible out of the box I have included the .cls and .sty files in the root directory. However, in an effort to keep the root directory uncluttered I would prefer to keep all the moderncv related files in a subdirectory (assets/tex/). I am able to access the .cls file using a relative path in the yaml front matter, but I am not able to access the .sty files unless they are in the root directory.
Searching previous questions on stackoverflow I learned the following: (1) keeping .cls and .sty files in nested directories is not recommended. I understand this and would like to do it anyway so that other people can fork my project and be able to knit the cv without having to deal with finding their texmk folder. (2) the solution to my problem seems to involve setting the TEXINPUTS using a Makefile (see this thread and another thread)
I am not very good with Makefiles, but I have managed to get one working that will knit my .Rmd file to pdf without problems, so long as the .sty files are still in root. This is what it looks like currently:
PDF_FILE=my_cv.pdf
all : $(PDF_FILE)
echo All files are now up to date
clean :
rm -f $(PDF_FILE)
%.pdf : %.Rmd
Rscript -e 'rmarkdown::render("$<")'
My understanding is that I can set the TEXINPUTS using:
export TEXINPUTS=".:./assets/tex:"
Where "assets/tex" represents the subdirectory where the .sty files are located. I do not know how to incorporate the above code into my makefile so that the .sty files are recognized in the subdirectories and my .Rmd is knit to PDF. In its current state, I get the following error if I remove the .sty files from root and put then in the aforementioned subdirectory:
! LaTeX Error: Command \fax already defined.
Or name \end... illegal, see p.192 of the manual.
which I assume is occurring because the moderncv class needs---and cannot locate---the relevant .sty files.
You could try to define the environment variable in the make rule:
%.pdf : %.Rmd
export TEXINPUTS=".:./assets/tex:"
Rscript -e 'rmarkdown::render("$<")'
Or you could set the environment variable in a set-up chunk in your Rmd file:
```{r setup, include = FALSE}
Sys.setenv(TEXINPUTS=".:./assets/tex:")
```
Note: Not tested due to lack of minimal example.

SonarQube: Ignore files in current (root) directory

The documentation of the project, instructs on how to e.g. exclude (or include) in an analysis process, say all files under a directory:
mydir/**/*
or all files with a specific extension (say .js) under a directory:
mydir/**/*.js
But what is the way to exclude all *.js files in the current (the root) directory.
I have tried the following patterns. do not seem to work:
sonar.coverage.exclusions=./*.js
sonar.coverage.exclusions=*.js
The multi-directory pattern, **, can be used at any point in the regex.
To exclude all .js files, you would use: **/*.js
To exclude .js files only in the current directory: *.js
However
You should not try to set these values in your analysis properties. Doing so correctly is tricky. Use the UI to set these values instead.

How do I get PyCharm File Watcher to maintain my directory structure for SCSS output

I am currently working on getting automatic SCSS -> CSS conversion set up using PyCharm's File Watcher functionality. I am able to have the files output to another directory, but I cannot get them to do it relative to a specific directory. Currently, I have the following settings and relevant file tree:
Tree
|media/
|-c/
| |-css/
| |-folder/
| | |-file2.css
| --file.css
--src/
|-css/
|-folder/
| |-file2.scss
--file.scss
File Watcher Settings
Scope is the media/src/css/ directory and all subdirectories recursively
Arguments is --no-cache --update $FileName$:$ProjectFileDir$/media/c/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.css
Working directory is $ProjectFileDir$/media/src/css/
Output paths to refresh is $ProjectFileDir$/media/c/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.css
With these settings, when I update file2.scss, there is an error stating that media/c/media/src/css/folder does not exist, which is not where I want the file anyway.
The issue that I am having is that I would like to have all paths relative to the working directory root preserved (ie. media/src/css/folder -> media/c/css/folder, but all of my source SCSS files are under multiple folder levels from the project root and the tutorial only specifies how to maintain folder structure if you are compiling directly below the root, not a folder below the root. Does anyone know a way that my folder structure could be preserved so that anything under media/src/css would have the same relative output in media/c/css?
The CrazyCoder posted solution in another Question. It is hard to find, so I'm linking it. https://stackoverflow.com/a/15965088/2047157
Quoting:
The trick is to use $FileDirPathFromParent(dir)$ macro:

Include path in makefile to include subdirectories

I have a directory which internal contains sub directories. I want to include the parent directory as include path in make file for header files. Is there a syntax so that all the sub directories are searched for the header files.
[EDIT] Posting the question in more detail
There are three sub folders in a parent folder
parentFolder/child1
parentFolder/child2
parentFolder/child3
There are header files in each all subfolders
Using -I option in makefile for header file path, i have to use
HEADER_PATH += -I./parentFolder
HEADER_PATH += -I./parentFolder/child1
HEADER_PATH += -I./parentFolder/child2
HEADER_PATH += -I./parentFolder/child3
Is there any way I can mention only the parent folder , but the search for header files will happen in all the subfolders also
http://www.gnu.org/software/make/manual/html_node/Recursion.html
Setup variable in first makefile and export it for sub-dirs. If you want to be able to invoke make in subdirs manually - i suppose best way to achieve this is either using configure-like systems to generate paths for you, or setting global variable (e.g. YOURPROJECT_DIR) in .profile or .bashrc and using it in makefiles.
I would like to see better solutions since i've encountered quite the same problem some time ago.

RUBYLIB Environment Path

So currently I have included the following in my .bashrc file.
export RUBYLIB=/home/git/project/app/helpers
I am trying to run rspec with a spec that has
require 'output_helper'
This file is in the helpers directory. My question is that when I change the export line to:
export RUBYLIB=/home/git/project/
It no longer finds the helper file. I thought that ruby should search the entire path I supply, and not just the outermost directory supplied? Is this the correct way to think about it? And if not, how can I make it so RUBY will search through all subdirectories and their subdirectories, etc?
Thanks,
Robin
Similar to PATH, you need to explicitly name the directory under which to look for libraries. However, this will not include any child directories within, so you will need to list any child sub-directories as well, delimiting them with a colon.
For example:
export RUBYLIB=/home/git/project:/home/git/project/app/helpers
As buruzaemon mentions, Ruby does not search subdirectories, so you need to include all the directories you want in your search path. However, what you probably want to do is:
require 'app/helpers/output_helper'
This way you aren't depending on the RUBYLIB environment variable being set a certain way. When you're deploying code to production, or collaborating with others, these little dependencies can make for annoying debugging sessions.
Also as a side note, you can specify . as a search path, rather than using machine-specific absolute paths.

Resources