Skip to content

Commit

Permalink
Merge pull request #839 from oxygen-dioxide/voicebank-install
Browse files Browse the repository at this point in the history
Fix unable to install vb from Mac on Windows
  • Loading branch information
stakira authored Sep 16, 2023
2 parents 52d7201 + e2d8704 commit c5d3568
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions OpenUtau.Core/Classic/VoicebankInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("..")) {
Expand All @@ -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,
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion OpenUtau/ViewModels/SingerSetupViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c5d3568

Please sign in to comment.