Skip to content

Commit

Permalink
Новый релиз
Browse files Browse the repository at this point in the history
Программа sdel -- * теперь не прерывается, если не удалось удалить первый файл.
Исправлена возможная бесконечная рекурсия.
  • Loading branch information
fdsc committed May 13, 2023
1 parent 69746b1 commit 24d3dec
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
26 changes: 22 additions & 4 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,21 @@ public static int Main(string[] args)
// args = new string[] { ":prv" };
#endif

var returnCode = Main_OneArgument(args);
int returnCode = -1;
try
{
returnCode = Main_OneArgument(args);

if (returnCode != 0)
return returnCode;
// if (returnCode != 0)
if (returnCode == 101 || returnCode == 102)
return returnCode;
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("ERROR: " + ex.Message + "\n" + ex.StackTrace + "\n\n\n");
Console.ResetColor();
}


// sdel prv * добавляет новые параметры в конец
Expand Down Expand Up @@ -181,6 +192,7 @@ public static int Main_OneArgument(string[] args)

if (args.Length < 2 || isFirstFileError)
{
Console.WriteLine("sdel version: 2023 may 13");
Console.Error.WriteLine("sdel 'flags' dir");
Console.WriteLine("Examples:");
Console.WriteLine("sdel - /home/user/.wine");
Expand Down Expand Up @@ -1134,7 +1146,13 @@ private static void deleteFile(FileInfo file, List<byte[]> bt, Progress progress
continue;
}

deleteFile(new FileInfo(newFileName), bt, progress: progress, false);
// Кто сказал, что newFileName можно удалять?
// В целом, его можно удалять, т.к. мы удаляем целую директорию - флаг onlyOne
// deleteFile(new FileInfo(newFileName), bt, progress: progress, false);
// Однако, есть проблема.
// Есть мы не можем удалить текущий файл, то не сможем удалить и этот:
// ведь у него одинаковая длина и он также будет переименован в аналогичные имена
continue;
}

// Похоже, FileInfo.MoveTo перемещает файл путём копирования, а затем - удаления. Это не то, что нам надо
Expand Down
17 changes: 12 additions & 5 deletions builded.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
For builds see [publish](https://github.com/VinnySmallUtilities/sdel/tree/master/publish) directory.
For help - see [README.md](https://github.com/VinnySmallUtilities/sdel) directory.

sdel-dotnet for execute with dotnet sdel.dll

sdel-dotnet for execute with command "dotnet sdel.dll" (entire folder required)
(< 1 Mb)
[sdel-dotnet.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-dotnet.7z)

sdel-lin64 for execute sdel (with .NET 7.0 on Linux)
sdel-lin64 for execute with command "sdel" (with .NET 7.0 on Linux; one file)
(< 1 Mb)
[sdel-lin64.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-lin64.7z)

sdel-lin64sc for execute sdel on Linux x64 without .NET 7.0
(~ 4 Mb)
[sdel-lin64sc.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-lin64sc.7z)


To install .NET 7.0 see [.NET 7.0](https://dotnet.microsoft.com/download)
Expand All @@ -23,14 +27,17 @@ To install .NET 7.0 see [.NET 7.0](https://dotnet.microsoft.com/download)
Для справки по программе - смотрите [README.md](https://github.com/VinnySmallUtilities/sdel) directory.


sdel-dotnet для выполнения с командой dotnet sdel.dll
sdel-dotnet для выполнения с командой "dotnet sdel.dll"
(< 1 Mb)
[sdel-dotnet.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-dotnet.7z)

sdel-lin64 для выполнения sdel (с установленной .NET 7.0 на Linux)
sdel-lin64 для выполнения командой "sdel" (с установленной .NET 7.0 на Linux)
(< 1 Mb)
[sdel-lin64.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-lin64.7z)

sdel-lin64sc для выполнения sdel на Linux x64 без установленной .NET 7.0
sdel-lin64sc для выполнения командой "sdel" на Linux x64 без установленной .NET 7.0
(~ 4 Mb)
[sdel-lin64sc.7z](https://github.com/VinnySmallUtilities/sdel/blob/master/publish/sdel-lin64sc.7z)


Для установки .NET 7.0 смотрите [.NET 7.0](https://dotnet.microsoft.com/download)
Binary file modified publish/sdel-dotnet.7z
Binary file not shown.
Binary file modified publish/sdel-lin64.7z
Binary file not shown.
Binary file modified publish/sdel-lin64sc.7z
Binary file not shown.

0 comments on commit 24d3dec

Please sign in to comment.