Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

copying additional files from a folder with name starting with % throws error
MartijnBosRHM
#1 Posted : Thursday, December 7, 2017 12:28:05 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/7/2017(UTC)
Posts: 3
Location: Netherlands

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
When copying the additional files to include, ncrunch trips when trying to copy a folder which name starts with a %-sign.
When trying to copy C:\sourcepath\%24name\%24name Analytics.item the following error is thrown.

Code:
System.IO.FileNotFoundException: Could not find file 'C:\sourcepath\24name Analytics.item'.
File name: 'C:\sourcepath\24name Analytics.item'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at nCrunch.Common.IO.FilePath.IsHidden()
   at nCrunch.Common.IO.DirectoryPath.(String )
   at nCrunch.Common.IO.DirectoryPath.ResolveFilesUsingExpression(String expression)
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(List`1 , List`1 , DirectoryPath , List`1 )
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(String[] )
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)

Is there a way I can convince ncrunch to copy these files?
1 user thanked MartijnBosRHM for this useful post.
michaelkroes on 12/8/2017(UTC)
michaelkroes
#2 Posted : Friday, December 8, 2017 4:46:31 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 280
Location: Netherlands

Thanks: 124 times
Was thanked: 63 time(s) in 60 post(s)
Thanks for posting this and bringing it to our attention!

We currently can't handle two % markers in one path. They are parsed as an environment variable. (ie. %APPDATA%) As a work around, could you perhaps add the files to the project? Or change the directory name?
MartijnBosRHM
#3 Posted : Monday, December 11, 2017 10:26:51 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/7/2017(UTC)
Posts: 3
Location: Netherlands

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Unfortunately I cannot include the files to the project, nor change the directory name.

It would be nice to see an option where you could exclude some of the files or folder from the copy action like with the /EXCLUDE on xcopy.

I was not able to add a line to the Additional Files To Include setting with an environment variable in it. Is it possible to set a line using an environment variable in the Additional Files To Include setting?
If not, is it valid to interpret double %-sign as an environment variable in a string that cannot contain such a variable?
Remco
#4 Posted : Monday, December 11, 2017 9:27:23 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
MartijnBosRHM;11626 wrote:

I was not able to add a line to the Additional Files To Include setting with an environment variable in it. Is it possible to set a line using an environment variable in the Additional Files To Include setting?
If not, is it valid to interpret double %-sign as an environment variable in a string that cannot contain such a variable?


In theory, yes, this could work.

When NCrunch parses the path for the % symbol, it will only make one pass of the string. This means that if you have an environment variable with a name that matches its value, you could make the algorithm do a null substitution.

The condition here would be that you'd need to have an environment variable for every directory containing the %. It's possible that this will only work when two percentage values are involved...
MartijnBosRHM
#5 Posted : Tuesday, December 12, 2017 10:12:53 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/7/2017(UTC)
Posts: 3
Location: Netherlands

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Ah I see what you mean. This would be a shakey solution in my opinion, but could work when there are not to many directories with a percentage sign that contain a file with a percentage sign.

What I meant was that I could not get a path with a environment variable in the Additional FIles To Include setting to begin with. So if I can't get a environment variable in there, why try to replace it?
Remco
#6 Posted : Tuesday, December 12, 2017 11:46:42 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
MartijnBosRHM;11632 wrote:
Ah I see what you mean. This would be a shakey solution in my opinion, but could work when there are not to many directories with a percentage sign that contain a file with a percentage sign.


Yes, it absolutely is. This is a defect in NCrunch and it will be fixed with a code fix in the next version. The focus right now is on finding a way to get you working until then.

MartijnBosRHM;11632 wrote:

What I meant was that I could not get a path with a environment variable in the Additional FIles To Include setting to begin with. So if I can't get a environment variable in there, why try to replace it?


The code responsible for swapping out the environment variables is handled very generically within NCrunch, and as such is applied to all file paths that can be fed into it. In this case, when the feature was added it was targeted to other areas of the software and its application to Additional Files To Include was incidental. Unfortunately, it looks like the UI for specifying the additional files wasn't updated to handle it. In theory this could be worked around by specifying the values yourself using a text editor in the config file directly.
1 user thanked Remco for this useful post.
MartijnBosRHM on 12/12/2017(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download