mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 18:13:46 +01:00
fix: unicode filenames with comments
This commit is contained in:
parent
0f365a3f65
commit
469acc3fb7
19
hslib.pas
19
hslib.pas
@ -385,28 +385,11 @@ begin if c then result:=a else result:=b end;
|
||||
function min(a,b:integer):integer;
|
||||
begin if a < b then result:=a else result:=b end;
|
||||
|
||||
// this table is to be used by ipos(), to be calculated once
|
||||
var
|
||||
upcaseTab: array [char] of char;
|
||||
function ipos(ss, s: string; ofs:integer=1):integer; overload;
|
||||
|
||||
procedure initTab();
|
||||
var
|
||||
i: char;
|
||||
tmp: string;
|
||||
begin
|
||||
for i:=#0 to #255 do
|
||||
begin
|
||||
tmp:=ansiUppercase(i);
|
||||
upcaseTab[i]:=tmp[1];
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
rss, rs, rss1, p: pchar;
|
||||
l: integer;
|
||||
begin
|
||||
if upcaseTab[#1] = #0 then initTab();
|
||||
result:=0;
|
||||
l:=length(s);
|
||||
if (l < ofs) or (l = 0) or (ss = '') then exit;
|
||||
@ -418,7 +401,7 @@ for result:=ofs to l do
|
||||
begin
|
||||
rss:=rss1;
|
||||
p:=rs;
|
||||
while (rss^ <> #0) and (rss^ = upcaseTab[p^]) do
|
||||
while (rss^ <> #0) and (rss^ = upcase(p^)) do
|
||||
begin
|
||||
inc(rss);
|
||||
inc(p);
|
||||
|
||||
8
main.pas
8
main.pas
@ -1644,7 +1644,7 @@ this would let us have "=" inside the names, but names cannot be assigned
|
||||
comments:=THashedStringList.create();
|
||||
try
|
||||
comments.caseSensitive:=FALSE;
|
||||
try comments.loadFromFile(folder.resource+'\'+COMMENTS_FILE);
|
||||
try comments.loadFromFile(folder.resource+'\'+COMMENTS_FILE, TEncoding.UTF8);
|
||||
except end;
|
||||
loadIon(folder.resource, comments);
|
||||
i:=if_((filesFilter='\') or (urlFilesFilter='\'), faDirectory, faAnyFile);
|
||||
@ -2500,7 +2500,7 @@ try
|
||||
try
|
||||
try
|
||||
comments.CaseSensitive:=FALSE;
|
||||
comments.LoadFromFile(resource+'\..\'+COMMENTS_FILE);
|
||||
comments.LoadFromFile(resource+'\..\'+COMMENTS_FILE, TEncoding.UTF8);
|
||||
result:=comments.values[name];
|
||||
except end
|
||||
finally
|
||||
@ -4392,7 +4392,7 @@ var
|
||||
// comments file
|
||||
try
|
||||
fn:=lastPath+COMMENTS_FILE;
|
||||
ss.loadFromFile(fn);
|
||||
ss.loadFromFile(fn, TEncoding.UTF8);
|
||||
anyChange:=FALSE;
|
||||
for i:=trancheStart to trancheEnd do
|
||||
begin
|
||||
@ -4405,7 +4405,7 @@ var
|
||||
if ss.count = 0 then
|
||||
deleteFile(fn)
|
||||
else
|
||||
ss.saveToFile(fn);
|
||||
ss.saveToFile(fn, TEncoding.UTF8);
|
||||
except end;
|
||||
// descript.ion
|
||||
if not mainfrm.supportDescriptionChk.checked then exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user