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;
|
function min(a,b:integer):integer;
|
||||||
begin if a < b then result:=a else result:=b end;
|
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;
|
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
|
var
|
||||||
rss, rs, rss1, p: pchar;
|
rss, rs, rss1, p: pchar;
|
||||||
l: integer;
|
l: integer;
|
||||||
begin
|
begin
|
||||||
if upcaseTab[#1] = #0 then initTab();
|
|
||||||
result:=0;
|
result:=0;
|
||||||
l:=length(s);
|
l:=length(s);
|
||||||
if (l < ofs) or (l = 0) or (ss = '') then exit;
|
if (l < ofs) or (l = 0) or (ss = '') then exit;
|
||||||
@ -418,7 +401,7 @@ for result:=ofs to l do
|
|||||||
begin
|
begin
|
||||||
rss:=rss1;
|
rss:=rss1;
|
||||||
p:=rs;
|
p:=rs;
|
||||||
while (rss^ <> #0) and (rss^ = upcaseTab[p^]) do
|
while (rss^ <> #0) and (rss^ = upcase(p^)) do
|
||||||
begin
|
begin
|
||||||
inc(rss);
|
inc(rss);
|
||||||
inc(p);
|
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();
|
comments:=THashedStringList.create();
|
||||||
try
|
try
|
||||||
comments.caseSensitive:=FALSE;
|
comments.caseSensitive:=FALSE;
|
||||||
try comments.loadFromFile(folder.resource+'\'+COMMENTS_FILE);
|
try comments.loadFromFile(folder.resource+'\'+COMMENTS_FILE, TEncoding.UTF8);
|
||||||
except end;
|
except end;
|
||||||
loadIon(folder.resource, comments);
|
loadIon(folder.resource, comments);
|
||||||
i:=if_((filesFilter='\') or (urlFilesFilter='\'), faDirectory, faAnyFile);
|
i:=if_((filesFilter='\') or (urlFilesFilter='\'), faDirectory, faAnyFile);
|
||||||
@ -2500,7 +2500,7 @@ try
|
|||||||
try
|
try
|
||||||
try
|
try
|
||||||
comments.CaseSensitive:=FALSE;
|
comments.CaseSensitive:=FALSE;
|
||||||
comments.LoadFromFile(resource+'\..\'+COMMENTS_FILE);
|
comments.LoadFromFile(resource+'\..\'+COMMENTS_FILE, TEncoding.UTF8);
|
||||||
result:=comments.values[name];
|
result:=comments.values[name];
|
||||||
except end
|
except end
|
||||||
finally
|
finally
|
||||||
@ -4392,7 +4392,7 @@ var
|
|||||||
// comments file
|
// comments file
|
||||||
try
|
try
|
||||||
fn:=lastPath+COMMENTS_FILE;
|
fn:=lastPath+COMMENTS_FILE;
|
||||||
ss.loadFromFile(fn);
|
ss.loadFromFile(fn, TEncoding.UTF8);
|
||||||
anyChange:=FALSE;
|
anyChange:=FALSE;
|
||||||
for i:=trancheStart to trancheEnd do
|
for i:=trancheStart to trancheEnd do
|
||||||
begin
|
begin
|
||||||
@ -4405,7 +4405,7 @@ var
|
|||||||
if ss.count = 0 then
|
if ss.count = 0 then
|
||||||
deleteFile(fn)
|
deleteFile(fn)
|
||||||
else
|
else
|
||||||
ss.saveToFile(fn);
|
ss.saveToFile(fn, TEncoding.UTF8);
|
||||||
except end;
|
except end;
|
||||||
// descript.ion
|
// descript.ion
|
||||||
if not mainfrm.supportDescriptionChk.checked then exit;
|
if not mainfrm.supportDescriptionChk.checked then exit;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user