New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GetSupportDir not returning an absolute path #13525

Merged
merged 1 commit into from Jun 18, 2017

Conversation

Projects
None yet
3 participants
@obrakmann
Contributor

obrakmann commented Jun 17, 2017

Current bleed crashes with a misleading exception when using a Support dir. This fixes it.

Exception of type `System.ArgumentException`: Second path fragment must not be a drive or UNC name.
Parameter name: path2
  at System.IO.Path.InternalCombine (System.String path1, System.String path2) [0x00058] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.FileSystemEnumerableIterator`1[TSource].CommonInit () [0x00000] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.FileSystemEnumerableIterator`1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler`1[TSource] resultHandler, System.Boolean checkHost) [0x000d6] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) [0x00009] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) [0x00000] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.Directory.InternalGetFiles (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) [0x00000] in <a07d6bf484a54da2861691df910339b1>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x0001c] in <a07d6bf484a54da2861691df910339b1>:0 
  at OpenRA.ExternalMods..ctor (System.String launchPath) [0x00099] in /home/oliver/devel/openra/git/OpenRA.Game/ExternalMods.cs:58 
  at OpenRA.Game.Initialize (OpenRA.Arguments args) [0x003e6] in /home/oliver/devel/openra/git/OpenRA.Game/Game.cs:342 
  at OpenRA.Program.Run (System.String[] args) [0x00007] in /home/oliver/devel/openra/git/OpenRA.Game/Support/Program.cs:134 
  at OpenRA.Program.Main (System.String[] args) [0x00050] in /home/oliver/devel/openra/git/OpenRA.Game/Support/Program.cs:40 
@rob-v

rob-v approved these changes Jun 17, 2017 edited

👍
btw at least on Windows there is small issue, not causing an error though, as e.g. File.Exists(Open) works also with such path with double \ e.g.:
C:\Users\rob\Documents\OpenRA\\settings.yaml

ResolvePath is called with Path.Combine("^", "settings.yaml") or "^testpath". ResolvePath removes only ^: SupportDir + path.Substring(1) and SupportDir contains \ at the end.
IMO Path.Combine shouldn't be used with ^, simply "^settings.yaml", "^ModMetadata" or \ should be removed in ResolvePath.

@rob-v

small issue/suggestion

Show outdated Hide outdated OpenRA.Game/Platform.cs
@rob-v

(I didn't know how to remove Approve other way than by 'Request changes')

@rob-v

rob-v approved these changes Jun 18, 2017

👍

@reaperrr reaperrr merged commit f6e87f6 into OpenRA:bleed Jun 18, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@obrakmann obrakmann deleted the obrakmann:fix-support-dir-crash branch Jun 18, 2017

@pchote pchote referenced this pull request Jun 22, 2017

Merged

Fix PlatformTests #13517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment