Skip to content

Commit

Permalink
(GH-164) Fix "The path is not of a legal form"
Browse files Browse the repository at this point in the history
When file_system.get_full_path is passed an empty string resulting from grabbing
the directory name, it would throw the error above. Instead, allow it to return
immediately, then use the current directory instead.

This usually happens when calling `choco pack some.nuspec`.
  • Loading branch information
ferventcoder committed Apr 11, 2015
1 parent 91dc3f9 commit f810e18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public void pack_run(ChocolateyConfiguration config)
{
string nuspecFilePath = validate_and_return_package_file(config, Constants.ManifestExtension);
var nuspecDirectory = _fileSystem.get_full_path(_fileSystem.get_directory_name(nuspecFilePath));
if (string.IsNullOrWhiteSpace(nuspecDirectory)) nuspecDirectory = _fileSystem.get_current_directory();

IDictionary<string, string> properties = new Dictionary<string, string>();
// Set the version property if the flag is set
Expand Down
2 changes: 2 additions & 0 deletions src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public string combine_paths(string leftItem, params string[] rightItems)

public string get_full_path(string path)
{
if (string.IsNullOrWhiteSpace(path)) return path;

return Path.GetFullPath(path);
}

Expand Down

0 comments on commit f810e18

Please sign in to comment.