Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
yibei333 committed Oct 8, 2024
1 parent cf42bfd commit 019ab40
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.3.2-alpha
1.0.3.3-alpha
12 changes: 11 additions & 1 deletion src/SingleExe.Tool/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public async ValueTask ExecuteAsync(IConsole console)
PrepareBinaryFiles(console, tempFolder);
BuildProject(console, tempFolder);
CopyFileToTarget(console, tempFolder);
CopyFileToTarget(console, tempFolder);
Clean(console, tempFolder);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -115,7 +117,7 @@ bool EnsureParameterCorrect(IConsole console)

string PrepareProject(IConsole console)
{
var tempFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), $"SingleExe\\{Name}\\{AppVersion}");
var tempFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), $"SingleExe\\{Name}");
tempFolder.CreateDirectoryIfNotExist();
CopyProjectFiles(console, tempFolder);
ReplaceProjectInformation(tempFolder);
Expand Down Expand Up @@ -201,4 +203,12 @@ void CopyFileToTarget(IConsole console, string tempFolder)
File.Copy(filePath, targetPath, true);
console.WriteSuccess($"生成成功,文件位置'{targetPath}'");
}

static void Clean(IConsole console, string tempFolder)
{
console.WriteInformation("开始清理");
if (Directory.Exists(tempFolder)) Directory.Delete(tempFolder, true);
var parent = new DirectoryInfo(tempFolder).Parent;
if (parent != null && parent.GetDirectories().IsNullOrEmpty() && parent.GetFiles().IsNullOrEmpty()) parent.Delete(true);
}
}
2 changes: 1 addition & 1 deletion src/SingleExe.Tool/SingleExe.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>1.0.3.2-alpha</Version>
<Version>1.0.3.3-alpha</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageReadmeFile>Nuget.md</PackageReadmeFile>
<AssemblyName>single-exe</AssemblyName>
Expand Down

0 comments on commit 019ab40

Please sign in to comment.