Skip to content

Commit

Permalink
Fix file links
Browse files Browse the repository at this point in the history
  • Loading branch information
miroljub1995 committed May 28, 2024
1 parent 5fe75f0 commit d135f68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DownloadArchive/DownloadArchive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>DownloadArchive</PackageId>
<Version>1.0.13</Version>
<Version>1.0.14</Version>
<Authors>MyDesigns Devs</Authors>
<Company>MyDesigns</Company>
<RepositoryUrl>https://github.com/madcoons/nuget-download-archive.git</RepositoryUrl>
Expand Down
34 changes: 24 additions & 10 deletions DownloadArchive/OutputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,33 @@ static void CopyDirectory(string sourceDir, string destinationDir)
throw new DirectoryNotFoundException($"Source directory not found: {dir.FullName}");
}

Directory.CreateDirectory(destinationDir);

DirectoryInfo[] dirs = dir.GetDirectories();
foreach (FileInfo file in dir.GetFiles())
if (dir.LinkTarget is not null)
{
string targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
Directory.CreateSymbolicLink(destinationDir, dir.LinkTarget);
}

foreach (DirectoryInfo subDir in dirs)
else
{
string newDestinationDir = Path.Combine(destinationDir, subDir.Name);
CopyDirectory(subDir.FullName, newDestinationDir);
Directory.CreateDirectory(destinationDir);

DirectoryInfo[] dirs = dir.GetDirectories();
foreach (FileInfo file in dir.GetFiles())
{
string targetFilePath = Path.Combine(destinationDir, file.Name);
if (file.LinkTarget is not null)
{
File.CreateSymbolicLink(targetFilePath, file.LinkTarget);
}
else
{
file.CopyTo(targetFilePath);
}
}

foreach (DirectoryInfo subDir in dirs)
{
string newDestinationDir = Path.Combine(destinationDir, subDir.Name);
CopyDirectory(subDir.FullName, newDestinationDir);
}
}
}
}

0 comments on commit d135f68

Please sign in to comment.