fix: #19: No subfolders when exporting to carousel

A game view with a "/" or a "\" in the name will be replaced with a "-" so that no subfolders are created since PCUAE does not support it.
This commit is contained in:
lantzelot-swe 2023-10-08 21:26:30 +02:00
parent 5024f60ddd
commit f19cacbd93
1 changed files with 11 additions and 6 deletions

View File

@ -132,11 +132,9 @@ public class ExportManager
{
for (GameView gameView : gameViewList)
{
Path targetPath = targetDir.toPath().resolve(gameView.getName());
if (!fileLoader)
{
targetPath = targetDir.toPath().resolve(gameView.getName().replace(" ", "_"));
}
String viewName = fileLoader ? gameView.getName() : getGameViewNameForCarousel(gameView.getName());
Path targetPath = targetDir.toPath().resolve(viewName);
try
{
Files.createDirectories(targetPath);
@ -159,6 +157,13 @@ public class ExportManager
}
}
}
private String getGameViewNameForCarousel(String viewName)
{
String returnValue = viewName.replace(" ", "_");
returnValue = returnValue.replace("\\", "-");
return returnValue.replace("/", "-");
}
public boolean isDeleteBeforeExport()
{
@ -176,7 +181,7 @@ public class ExportManager
{
for (GameView gameView : gameViewList)
{
Path targetPath = targetDir.toPath().resolve(gameView.getName().replace(" ", "_"));
Path targetPath = targetDir.toPath().resolve(getGameViewNameForCarousel(gameView.getName()));
copyFilesForCarousel(worker, targetPath, gameDetailsForViewsMap.get(gameView));
}
}