Skip to content

Commit

Permalink
big slash revolution! changed most of default slashes from '\' to '/'…
Browse files Browse the repository at this point in the history
… (not all; left some code path for windows network share paths and drive letters untouched). of course we will need some platform-dependent macro for slashes someday, but currently i am working just on working linux port
  • Loading branch information
unxed committed Oct 25, 2020
1 parent 738abbd commit 0009936
Show file tree
Hide file tree
Showing 46 changed files with 225 additions and 223 deletions.
8 changes: 4 additions & 4 deletions DNStdDlg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function GetCurDir: String;
CurDir: String;
begin
lGetDir(0, CurDir);
if Length(CurDir) > 3 then CurDir:=CurDir+'\';
if Length(CurDir) > 3 then CurDir:=CurDir+'/'; // slash change by unxed
GetCurDir := CurDir;
end;
}
Expand Down Expand Up @@ -346,7 +346,7 @@ procedure TFileInputLine.HandleEvent(var Event: TEvent);
(State and sfSelected = 0)
then
begin
Dir := PSearchRec(Event.InfoPtr)^.Name+'\';
Dir := PSearchRec(Event.InfoPtr)^.Name+'/'; // slash change by unxed
if PSearchRec(Event.InfoPtr)^.Attr and Directory <> 0 then
Data := Dir+
PFileDialog(Owner)^.WildCard^
Expand Down Expand Up @@ -711,7 +711,7 @@ function TDirectoryList.GetText(Item: LongInt; MaxLen: Integer): String;
S[12] := FMSetup.RestChar[1];
end;
if SR^.Name[2] <> ':' then
GetText := S+'\'
GetText := S+'/' // slash change by unxed
else
GetText := SR^.Name;
end;
Expand Down Expand Up @@ -1387,7 +1387,7 @@ function TFileDialog.Valid(Command: Word): Boolean;
if CheckDirectory(lFName) then
begin
DisposeStr(Directory);
Directory := NewStr(lFName+'\');
Directory := NewStr(lFName+'/'); // slash change by unxed
DirList^.ReadDirectory(Directory^+WildCard^);
FileList^.ReadDirectory(Directory^+WildCard^);
if Command <> cmFileInit then
Expand Down
2 changes: 1 addition & 1 deletion DblWnd.pas
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ procedure TDoubleWindow.HandleCommand;
if S <> '' then
begin
if not (S[Length(S)] in ['\', '/']) then
AddStr(S, '\');
AddStr(S, '/'); // slash change by unxed
S := SquashesName(S);
Message(CommandLine, evCommand, cmInsertName, @S);
end;
Expand Down
2 changes: 1 addition & 1 deletion FLTools.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ procedure DoRenameSingle(PF: PFileRec; const S, S2: String; DlgRes: Word);
label
NameErr;
begin
if PosChar('\', S) <> 0 then
if PosChar('/', S) <> 0 then // slash change by unxed
begin
DosE := 123; // ERROR_INVALID_NAME
goto NameErr;
Expand Down
12 changes: 6 additions & 6 deletions advance2.pas
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ function InDirFilter;
Delete(S, 1, 1); {DelFC(S);}
DelLeft(S);
DelRight(S);
if (S <> '') and (S[Length(S)] = '\')
if (S <> '') and (S[Length(S)] = '/') // slash change by unxed
and InMask(Name, Copy(S, 1, Length(S)-1))
then
Exit;
Expand Down Expand Up @@ -1124,7 +1124,7 @@ function MakeNormName(const S, S1: String): String;
if (S[i] in ['\', '/']) then
MakeNormName := Copy(S, 1, i)+Copy(S1, 1, j)
else
MakeNormName := Copy(S, 1, i)+'\'+Copy(S1, 1, j);
MakeNormName := Copy(S, 1, i)+'/'+Copy(S1, 1, j); // slash change by unxed
end
else
MakeNormName := S1;
Expand Down Expand Up @@ -1168,7 +1168,7 @@ function PathExist(s: String): Boolean;
else
begin
S := lFExpand(S);
IsRoot := S[Length(s)] = '\';
IsRoot := S[Length(s)] = '/'; // slash change by unxed

Attr := AnyFileDir or (Directory shl 8);
lFindFirst(S, Attr, SR);
Expand All @@ -1195,7 +1195,7 @@ function PathExist(s: String): Boolean;
begin { ª®à¥­ì ¤¨áª  }
delete(S, Length(s), 1);
end;
S := S + '\*.*';
S := S + '/*.*'; // slash change by unxed
lFindFirst(S, Attr, SR);
Result := DosError in [0, 2, 18];
FClose:
Expand Down Expand Up @@ -1403,8 +1403,8 @@ function CompareFiles(const N1, N2: String): Boolean;

procedure MakeSlash(var S: String);
begin
if (S <> '') and (S[Length(S)] <> '\') then
S := S + '\';
if (S <> '') and (S[Length(S)] <> '/') then // slash change by unxed
S := S + '/'; // slash change by unxed
end;

procedure MakeNoSlash(var S: String);
Expand Down
6 changes: 3 additions & 3 deletions advance7.pas
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ function ValidLngId(LI: String; CheckForHelp: Boolean): Boolean;
if S1 = '' then
S1 := SourceDir;
if not (S1[Length(S1)] in ['\', '/']) then
S1 := S1+'\';
S1 := S1+'/'; // slash change by unxed
S2 := StartupDir;
if not (S2[Length(S2)] in ['\', '/']) then
S2 := S2+'\';
S2 := S2+'/'; // slash change by unxed
if (not CheckForHelp) and (not ExistFile(S1+LI+'.DLG')) and
(not ExistFile(S2+LI+'.DLG'))
then
Expand All @@ -86,7 +86,7 @@ function ValidLngId(LI: String; CheckForHelp: Boolean): Boolean;
begin
S1 := SourceDir;
if not (S1[Length(S1)] in ['\', '/']) then
S1 := S1+'\';
S1 := S1+'/'; // slash change by unxed
if (not ExistFile(S1+LI+'.HLP')) and (not ExistFile(S2+LI+'.HLP'))
then
Exit
Expand Down
2 changes: 1 addition & 1 deletion arch7z.pas
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ procedure TS7ZArchive.GetFile;
FileInfo.Attr := Directory
else
FileInfo.Attr := 0;
FileInfo.FName := '\'+fDelRight(Copy(S, 54, 255));
FileInfo.FName := '/'+fDelRight(Copy(S, 54, 255)); // slash change by unxed
FileInfo.Last := 0;
end { TS7ZArchive.GetFile };

Expand Down
4 changes: 2 additions & 2 deletions archchz.pas
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ procedure TCHZArchive.GetFile;
ArcFile^.Seek(FP+9);
ArcFile^.Read(S[0], 1);
ArcFile^.Read(S[1], Length(S));
CDir := CDir+S+'\';
CDir := CDir+S+'/'; // slash change by unxed
goto 1;
end
else if P.Id[4] = 'd' then
begin
if CDir <> '' then
begin
SetLength(CDir, Length(CDir)-1);
while (CDir <> '') and (CDir[Length(CDir)] <> '\') do
while (CDir <> '') and (CDir[Length(CDir)] <> '/') do // slash change by unxed
SetLength(CDir, Length(CDir)-1);
end;
goto 1;
Expand Down
2 changes: 1 addition & 1 deletion archdet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function HPKDetect: Boolean;
S := S+C
until C = #0;
if I < P.noDirHdrs
then S := S +'\';
then S := S +'/'; // slash change by unxed
PHPKRec(HPKCol^.At(I))^.Name := NewStr(S);
end;
Exit;
Expand Down
2 changes: 1 addition & 1 deletion archha.bak
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ procedure THAArchive.GetFile;
FileInfo.Last := 2;
Exit;
end;
Replace(#255, '\', FileInfo.FName);
Replace(#255, '/', FileInfo.FName); // slash change by unxed
if P.Method and $0f = $0e then
FileInfo.Attr := Directory;
ArcFile^.Read(C, 1);
Expand Down
2 changes: 1 addition & 1 deletion archis3.pas
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ procedure TIS3Archive.GetFile;
begin
ArcFile^.Seek(FO);
ArcFile^.Read(S[1], P1.SizeOfName);
FileInfo.FName := S+'\'+FileInfo.FName;
FileInfo.FName := S+'/'+FileInfo.FName; // slash change by unxed
end;

FileInfo.Last := 0;
Expand Down
16 changes: 8 additions & 8 deletions archiver.pas
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ procedure MakeArchive;
Writeln(F.T, {$IFDEF RecodeWhenDraw}CharToOemStr {$ENDIF}(S1))
{piwamoto.src.begin}
else if B then
S := S+#$14+SquashesName(S1+'\*.*')
S := S+#$14+SquashesName(S1+'/*.*') // slash change by unxed
else if Arc^.PutDirs then
PutDir(S1)
else {JO}
Expand All @@ -941,7 +941,7 @@ procedure MakeArchive;
lFindClose(SR);
ClrIO;
Writeln(F.T, {$IFDEF RecodeWhenDraw}CharToOemStr
{$ENDIF}(S1)+'\*.*');
{$ENDIF}(S1)+'/*.*'); // slash change by unxed
end; {/JO}
{piwamoto.src.end}
MakeListFile := S;
Expand Down Expand Up @@ -1276,7 +1276,7 @@ procedure MakeArchive;
begin
while (SIntern[Length(SIntern)] = '.') do
SetLength(SIntern, Length(SIntern)-1);
while (SIntern[1] = '\') do
while (SIntern[1] = '/') do // slash change by unxed
Delete(SIntern, 1, 1);
MakeNoSlash(SIntern);
SIntern := CnvString(Arc^.SetPathInside)+
Expand Down Expand Up @@ -1363,8 +1363,8 @@ procedure UnarchiveFiles;
DT.S := HistoryStr(hsExtract, 0);
if DT.S = cTEMP_ then
DT.S := '';
if (Length(DT.S) > 3) and (DT.S[Length(DT.S)] <> '\') then
DT.S := DT.S+'\';
if (Length(DT.S) > 3) and (DT.S[Length(DT.S)] <> '/') then // slash change by unxed
DT.S := DT.S+'/'; // slash change by unxed
{JO}
// ¯p®¢¥p塞, ­ å®¤¨âáï «¨ ¤¨áª ¢ ᯨ᪥ ¤¨áª®¢, ­  ª®â®pë¥ ­ ¤®
// p § p娢¨p®¢ âì ­¥ ç¥p¥§ ¢p¥¬¥­­ë© ¯®¤ª â «®£ (¯® 㬮«ç ­¨î A: ¨ B:)
Expand Down Expand Up @@ -1405,8 +1405,8 @@ procedure UnarchiveFiles;
if (DT.S = '') or (DT.S = '.') then
DT.S := GetPath(FName);
ExtrDir := DT.S;
if ExtrDir[Length(ExtrDir)] <> '\' then
ExtrDir := ExtrDir+'\';
if ExtrDir[Length(ExtrDir)] <> '/' then // slash change by unxed
ExtrDir := ExtrDir+'/'; // slash change by unxed

{JO}
// ¯à®¢¥à塞, ᮤ¥à¦¨â «¨ ª â «®£ ­ §­ ç¥­¨ï ä ©«ë
Expand Down Expand Up @@ -1564,7 +1564,7 @@ procedure UnarchiveFiles;
LFNvp.lChDir(S);
{$IFDEF DPMI32} {®á¢®¡®¦¤ ¥¬ ª â «®£}
if ActiveDir[2] = ':' then
ChDir(Copy(ActiveDir, 1, 2) + '\');
ChDir(Copy(ActiveDir, 1, 2) + '/'); // slash change by unxed
{$ENDIF}
Eraser.EraseFiles(FCT);
Confirms := OldConfirms;
Expand Down
2 changes: 1 addition & 1 deletion archlha.pas
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ procedure TLHAArchive.GetFile;
AddStr(s, P.Name[i]);
Inc(i)
end;
Replace(#255, '\', s);
Replace(#255, '/', s); // slash change by unxed
System.Insert(s, FileInfo.FName, 1);
end;
end;
Expand Down
2 changes: 1 addition & 1 deletion archlim.pas
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ procedure TLIMArchive.GetFile;
FileInfo.PSize := P.PackedSize;
FileInfo.Date := P.Date {P.Date shl 16) or (P.Date shr 16)};
GetName;
FileInfo.FName := CDir+'\'+FileInfo.FName;
FileInfo.FName := CDir+'/'+FileInfo.FName; // slash change by unxed
if P.ThreeZeros[3] and Directory <> 0 then
goto 1;
ArcFile^.Seek(ArcFile^.GetPos+P.PackedSize);
Expand Down
2 changes: 1 addition & 1 deletion archrar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ procedure TRARArchive.GetFile;
SetLength(FileInfo.FName, (PosChar(#0, FileInfo.FName)-1));
{piwamoto: skip unicode names from winrar2.80beta1+ archives}
repeat
Ps := System.Pos('.\', FileInfo.FName);
Ps := System.Pos('./', FileInfo.FName); // slash change by unxed
if Ps = 0 then
Break;
System.Delete(FileInfo.FName, Ps, 1);
Expand Down
10 changes: 5 additions & 5 deletions archread.pas
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ procedure ReadArcList; {changed & AIN added by piwamoto}
Continue;
SetLength(S, I-1);
if P^.Attr = Directory then
S := S+'\';
S := S+'/'; // slash change by unxed
P^.Attr := 0;
P^.FName := NewStr(CurDir+S);
end
Expand Down Expand Up @@ -225,14 +225,14 @@ procedure ReadArcList; {changed & AIN added by piwamoto}
I := PosChar(' ', S);
if I = 0 then
begin
P^.FName := NewStr('\'+S);
P^.FName := NewStr('/'+S); // slash change by unxed
S := F^.GetStr;
DelLeft(S);
DelRight(S);
end
else
begin
P^.FName := NewStr('\'+Copy(S, 1, I-1));
P^.FName := NewStr('/'+Copy(S, 1, I-1)); // slash change by unxed
Delete(S, 1, I);
DelLeft(S);
end;
Expand Down Expand Up @@ -285,10 +285,10 @@ procedure ReadArcList; {changed & AIN added by piwamoto}
if S[21] = 'D' {directory}
then begin
P^.Attr := Directory;
S := S + '\';
S := S + '/'; // slash change by unxed
end
else P^.Attr := 0;
P^.FName := NewStr('\'+fDelRight(Copy(S, 54, 255)));
P^.FName := NewStr('/'+fDelRight(Copy(S, 54, 255))); // slash change by unxed
PC^.AddFile(P^.FName^, P^.USize, P^.PSize, P^.Date, P^.Attr);
DisposeStr(P^.FName);
Dispose(P);
Expand Down
2 changes: 1 addition & 1 deletion archuc2.pas
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ procedure TUC2Archive.GetFile;
ReadName;
ReadDTA;
// FileInfo.Attr := Directory;
FileInfo.FName := FileInfo.FName+'\';
FileInfo.FName := FileInfo.FName+'/'; // slash change by unxed
FileInfo.USize := 0;
FileInfo.PSize := 0;
end
Expand Down
2 changes: 1 addition & 1 deletion archzoo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ procedure TZOOArchive.GetFile;
if S <> '' then
begin
ArcFile^.Read(S[1], Byte(S[0]));
S[Length(S)] := '\';
S[Length(S)] := '/'; // slash change by unxed
end;
FileInfo.FName := S+FileInfo.FName;
if FileInfo.FName = '' then
Expand Down
Loading

0 comments on commit 0009936

Please sign in to comment.