Skip to content
Snippets Groups Projects
Commit 6a926d33 authored by biwa's avatar biwa
Browse files

Some cleanup, added some comments.

parent 42be8992
No related branches found
No related tags found
No related merge requests found
...@@ -468,6 +468,7 @@ namespace CodeImp.DoomBuilder.Data ...@@ -468,6 +468,7 @@ namespace CodeImp.DoomBuilder.Data
{ {
MemoryStream s = null; MemoryStream s = null;
string casecorrectfilename = GetCorrectCaseForFile(filename); string casecorrectfilename = GetCorrectCaseForFile(filename);
try try
{ {
lock(this) lock(this)
...@@ -514,6 +515,11 @@ namespace CodeImp.DoomBuilder.Data ...@@ -514,6 +515,11 @@ namespace CodeImp.DoomBuilder.Data
return tempfile; return tempfile;
} }
/// <summary>
/// Returns the correctly cased file from a path/file. This is required for case sensitive file systems.
/// </summary>
/// <param name="filepathname">File name get the the correctly cased name from</param>
/// <returns></returns>
protected override string GetCorrectCaseForFile(string filepathname) protected override string GetCorrectCaseForFile(string filepathname)
{ {
return files.GetFileInfo(filepathname).filepathname; return files.GetFileInfo(filepathname).filepathname;
......
...@@ -741,23 +741,26 @@ namespace CodeImp.DoomBuilder.Data ...@@ -741,23 +741,26 @@ namespace CodeImp.DoomBuilder.Data
return images; return images;
} }
/// <summary>
/// Gets a correctly cased file from a path/file. This is required for case sensitive file systems.
/// </summary>
/// <param name="filename">File name without path</param>
/// <param name="pathname">Path to the file</param>
/// <param name="type">Type of file (i.e. everything before the first dot)</param>
/// <returns>Array with one element on success, array with no elements on failure</returns>
protected string[] GetFileAtPath(string filename, string pathname, string type) protected string[] GetFileAtPath(string filename, string pathname, string type)
{ {
string[] allfilenames;
string fullname = Path.Combine(pathname, filename); string fullname = Path.Combine(pathname, filename);
if (FileExists(fullname)) if (FileExists(fullname))
{ {
allfilenames = new string[1]; return new string[1] { GetCorrectCaseForFile(fullname) };
allfilenames[0] = Path.Combine(pathname, filename);
allfilenames[0] = GetCorrectCaseForFile(allfilenames[0]);
} }
else else
{ {
allfilenames = new string[0];
General.ErrorLogger.Add(ErrorType.Warning, "Unable to load " + type + " file \"" + fullname + "\""); General.ErrorLogger.Add(ErrorType.Warning, "Unable to load " + type + " file \"" + fullname + "\"");
return new string[0];
} }
return allfilenames;
} }
// This copies images from a collection unless they already exist in the list // This copies images from a collection unless they already exist in the list
...@@ -823,7 +826,11 @@ namespace CodeImp.DoomBuilder.Data ...@@ -823,7 +826,11 @@ namespace CodeImp.DoomBuilder.Data
} }
} }
// Unix-like systems have case-sensitive filesystems. Use this to correct the case of a filename with the given path. /// <summary>
/// Returns the correctly cased file from a path/file. This is required for case sensitive file systems. For PK3s the input will already have the correct case.
/// </summary>
/// <param name="filepathname">File name get the the correctly cased name from</param>
/// <returns></returns>
protected virtual string GetCorrectCaseForFile(string filepathname) protected virtual string GetCorrectCaseForFile(string filepathname)
{ {
return filepathname; return filepathname;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment