-
Notifications
You must be signed in to change notification settings - Fork 58
Fix Case-sensitive directory preservation in project reconstruction #27 #28
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using System.IO; | ||
| using System.Linq; | ||
|
|
||
| namespace RPGMakerDecrypter.MVMZ | ||
| { | ||
|
|
@@ -9,6 +10,7 @@ public abstract class ProjectReconstructor | |
| "audio", | ||
| "css", | ||
| "data", | ||
| "dataex", | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you confirmed by yourself that there actually can be a directory with this name?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I found that many games have this directory
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "effects", | ||
| "fonts", | ||
| "icon", | ||
|
|
@@ -34,14 +36,32 @@ public virtual void Reconstruct(string deploymentPath, string outputPath) | |
| Directory.CreateDirectory(outputPath); | ||
| } | ||
|
|
||
| // Get all top-level subdirectories and create lowercase-to-original mapping | ||
| var sourceDirectories = Directory.Exists(deploymentPath) | ||
| ? Directory.GetDirectories(deploymentPath, "*", SearchOption.TopDirectoryOnly) | ||
| : new string[0]; | ||
| var sourceDirectoryMap = sourceDirectories.ToDictionary( | ||
| directoryPath => Path.GetFileName(directoryPath).ToLowerInvariant(), | ||
| directoryPath => Path.GetFileName(directoryPath)); | ||
|
|
||
| foreach (var directory in _directories) | ||
| { | ||
| CopyDirectory(Path.Combine(deploymentPath, directory), Path.Combine(outputPath, directory)); | ||
| // Find actual directory name (case-insensitive) | ||
| if (sourceDirectoryMap.TryGetValue(directory.ToLowerInvariant(), out var actualDirectoryName)) | ||
| { | ||
| CopyDirectory( | ||
| Path.Combine(deploymentPath, actualDirectoryName), | ||
| Path.Combine(outputPath, actualDirectoryName)); | ||
| } | ||
| } | ||
|
|
||
| foreach (var file in _files) | ||
| { | ||
| File.Copy(Path.Combine(deploymentPath, file), Path.Combine(outputPath, file)); | ||
| var sourceFile = Path.Combine(deploymentPath, file); | ||
| if (File.Exists(sourceFile)) | ||
| { | ||
| File.Copy(sourceFile, Path.Combine(outputPath, file)); | ||
| } | ||
| } | ||
|
|
||
| CreateProjectFile(outputPath); | ||
|
|
@@ -69,4 +89,4 @@ private void CopyDirectory(string sourceDir, string destinationDir) | |
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.