Skip to content

Commit

Permalink
(GH-934) Support Paths > 260 Characters
Browse files Browse the repository at this point in the history
Installing a package or working with packaging could mean paths that
are over 260 characters (MAX_PATH). Sometimes backing up a path will
take it over 260 characters resulting in errors when attempting to
upgrade/uninstall packages that have pretty long paths.

This is done by using the AlphaFS library. Unfortunately it doesn't use
the .NET Framework methods and check lengths before it uses its
implementation with native calls so it doesn't appear to be Mono safe.
This meant the implementation of IFileSystem that is being used will
need to perform those checks and fall back on errors.

This also means the addition of dynamics to support switching between
two interpretations of FileInfo and DirectoryInfo.
  • Loading branch information
ferventcoder committed Sep 17, 2016
1 parent 10ad26f commit a19831f
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 58 deletions.
4 changes: 4 additions & 0 deletions src/chocolatey.console/chocolatey.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
<HintPath>..\packages\AlphaFS.2.0.1\lib\net40\AlphaFS.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.3\lib\net40-client\log4net.dll</HintPath>
</Reference>
Expand All @@ -101,6 +104,7 @@
<HintPath>..\..\lib\PowerShell\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey.console/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<packages>
<package id="AlphaFS" version="2.0.1" targetFramework="net40" />
<package id="log4net" version="2.0.3" targetFramework="net40" />
<package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net40" />
<package id="Nuget.Core" version="2.8.2" targetFramework="net40" />
Expand Down
4 changes: 4 additions & 0 deletions src/chocolatey/chocolatey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<ApplicationIcon>..\..\docs\logo\chocolatey.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS">
<HintPath>..\packages\AlphaFS.2.0.1\lib\net40\AlphaFS.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.3\lib\net40-client\log4net.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -73,6 +76,7 @@
<HintPath>..\packages\Rx-Linq.2.1.30214.0\lib\Net40\System.Reactive.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void handle_message(PreRunMessage message)
foreach (var pendingFile in pendingFiles.or_empty_list_if_null())
{
var packageFolder = _fileSystem.get_directory_name(pendingFile);
var packageFolderName = _fileSystem.get_directory_info_for(packageFolder).Name;
string packageFolderName = _fileSystem.get_directory_info_for(packageFolder).Name;

var pendingSkipFiles = _fileSystem.get_files(packageFolder, PENDING_SKIP_FILE, SearchOption.AllDirectories).ToList();
if (pendingSkipFiles.Count != 0)
Expand Down
Loading

0 comments on commit a19831f

Please sign in to comment.