Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ディレクトリの存在チェックを追加 #34

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions KoeBook/Services/CoreMocks/AnalyzerServiceMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class AnalyzerServiceMock(IDisplayStateChangeService stateService) : IAna

public async ValueTask<BookScripts> AnalyzeAsync(BookProperties bookProperties, string tempDirectory, CancellationToken cancellationToken)
{
Directory.CreateDirectory(tempDirectory);
DisplayStateChanging stateChanging;
if (bookProperties.SourceType == SourceType.Url)
{
Expand Down
8 changes: 6 additions & 2 deletions KoeBook/Services/GenerationTaskRunnerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ private async ValueTask RunAsync(GenerationTask task)
return;

await RunAsyncCore(task, true);
await RunAsyncCore(task, false);
if (task.SkipEdit)
await RunAsyncCore(task, false);
}

public async void RunGenerateEpubAsync(GenerationTask task)
Expand Down Expand Up @@ -83,7 +84,10 @@ private async ValueTask RunAsyncCore(GenerationTask task, bool firstStep)
task.Progress = 1;
task.MaximumProgress = 1;
var fileName = Path.GetFileName(resultPath);
File.Move(resultPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "KoeBook", fileName), true);
var resultDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "KoeBook");
if (!Directory.Exists(resultDirectory))
Directory.CreateDirectory(resultDirectory);
File.Move(resultPath, Path.Combine(resultDirectory, fileName), true);
}
else
throw new InvalidOperationException();
Expand Down
Loading