Skip to content

Commit

Permalink
ディレクトリの存在チェックを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Apr 13, 2024
1 parent 6dd9ce6 commit e46ddea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
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
8 changes: 4 additions & 4 deletions KoeBook/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"LocalSettingsFile": "LocalSettings.json"
},
"MockOptions": {
"IAnalyzerService": false,
"IEpubGenerateService": false,
"ISoundGenerationSelectorService": false,
"ISoundGenerationService": false
"IAnalyzerService": true,
"IEpubGenerateService": true,
"ISoundGenerationSelectorService": true,
"ISoundGenerationService": true
}
}

0 comments on commit e46ddea

Please sign in to comment.