From e2d87040be08f054f0e3e4bee009ab5a2267d474 Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:40:57 +0800 Subject: [PATCH] fix unable to install vb from Mac on Windows --- OpenUtau.Core/Classic/VoicebankInstaller.cs | 6 +++--- OpenUtau/ViewModels/SingerSetupViewModel.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenUtau.Core/Classic/VoicebankInstaller.cs b/OpenUtau.Core/Classic/VoicebankInstaller.cs index c96daa4e9..0502d830d 100644 --- a/OpenUtau.Core/Classic/VoicebankInstaller.cs +++ b/OpenUtau.Core/Classic/VoicebankInstaller.cs @@ -43,7 +43,7 @@ public void Install(string path, string singerType) { AdjustBasePath(archive, path, touches); int total = archive.Entries.Count(); int count = 0; - bool hasCharacterYaml = archive.Entries.Any(e => e.Key.EndsWith(kCharacterYaml)); + bool hasCharacterYaml = archive.Entries.Any(e => Path.GetFileName(e.Key) == kCharacterYaml); foreach (var entry in archive.Entries) { progress.Invoke(100.0 * ++count / total, entry.Key); if (entry.Key.Contains("..")) { @@ -54,7 +54,7 @@ public void Install(string path, string singerType) { Directory.CreateDirectory(Path.GetDirectoryName(filePath)); if (!entry.IsDirectory && entry.Key != kInstallTxt) { entry.WriteToFile(Path.Combine(basePath, entry.Key), extractionOptions); - if (!hasCharacterYaml && filePath.EndsWith(kCharacterTxt)) { + if (!hasCharacterYaml && Path.GetFileName(filePath) == kCharacterTxt) { var config = new VoicebankConfig() { TextFileEncoding = textEncoding.WebName, SingerType = singerType, @@ -63,7 +63,7 @@ public void Install(string path, string singerType) { config.Save(stream); } } - if (hasCharacterYaml && filePath.EndsWith(kCharacterYaml)) { + if (hasCharacterYaml && Path.GetFileName(filePath) == kCharacterYaml) { VoicebankConfig? config = null; using (var stream = File.Open(filePath, FileMode.Open)) { config = VoicebankConfig.Load(stream); diff --git a/OpenUtau/ViewModels/SingerSetupViewModel.cs b/OpenUtau/ViewModels/SingerSetupViewModel.cs index 54b0c3043..fe198b1d4 100644 --- a/OpenUtau/ViewModels/SingerSetupViewModel.cs +++ b/OpenUtau/ViewModels/SingerSetupViewModel.cs @@ -91,7 +91,7 @@ private void RefreshArchiveItems() { private VoicebankConfig? LoadCharacterYaml(string archiveFilePath) { using (var archive = ArchiveFactory.Open(archiveFilePath)) { - var entry = archive.Entries.FirstOrDefault(e => e.Key.EndsWith("character.yaml")); + var entry = archive.Entries.FirstOrDefault(e => Path.GetFileName(e.Key)=="character.yaml"); if (entry == null) { return null; }