Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
peazip authored May 11, 2024
1 parent c3a723e commit 1a52071
Show file tree
Hide file tree
Showing 30 changed files with 8,723 additions and 7,088 deletions.
624 changes: 624 additions & 0 deletions peazip-sources/dev/link6236.res

Large diffs are not rendered by default.

83 changes: 60 additions & 23 deletions peazip-sources/dev/list_utils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
0.61 20210925 G.Tani Nicenumber can now display various types of multiple-bytes fomats for file sizes (binary, decimanl, none)
0.62 20220125 G.Tani Added support for .vhdx format: 226 extensions supported
0.63 20221209 G.Tani Added support for .pmdx, .pmvx, .tmdx, .prdx SoftMaker Office files, 230 extensions supported
0.64 20240228 G.Tani Added function to check if a directory exists, checking both address with and without ending separator character
(C) Copyright 2006 Giorgio Tani [email protected]
The program is released under GNU LGPL http://www.gnu.org/licenses/lgpl.txt
Expand Down Expand Up @@ -391,6 +392,9 @@ function correctdelimiter(s:AnsiString): AnsiString;
//get desktop environment
procedure getdesk_env(var bytedesk: byte; var caption_build, delimiter: ansistring);

//set ending directory separator character if missing
procedure setendingdirseparator(var s:ansistring);

//get desktop path
procedure get_desktop_path(var s: ansistring);

Expand Down Expand Up @@ -460,6 +464,10 @@ function rLast(dir, mask: ansistring; //last modified time
var ltime:longint
): integer;

function checkdirexists(s:ansistring):boolean;

function checkfiledirexists(s:ansistring):boolean;

implementation

function nicetime(s: ansistring): ansistring;
Expand Down Expand Up @@ -1882,6 +1890,13 @@ procedure getdesk_env(var bytedesk: byte; var caption_build, delimiter: ansistri
end;
end;

procedure setendingdirseparator(var s:ansistring);
begin
if s<>'' then
if s[length(s)]<>directoryseparator then
s:=s+directoryseparator;
end;

procedure get_home_path(var s: ansistring); //superseded in Windows
begin
{$IFDEF MSWINDOWS}
Expand All @@ -1904,59 +1919,55 @@ procedure get_home_path(var s: ansistring); //superseded in Windows
{$ENDIF}
if s = '' then
s := (getcurrentdir);
if s<>'' then
if s[length(s)] <> directoryseparator then
s := s + directoryseparator;
setendingdirseparator(s);
end;

procedure get_home_subpaths(var usr_documents,usr_downloads,usr_music,usr_pictures,usr_videos: ansistring);
var
s:ansistring;
begin
{$IFNDEF MSWINDOWS}
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Documents/') then usr_documents := GetEnvironmentVariable('HOME') + '/Documents/';
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Downloads/') then usr_downloads := GetEnvironmentVariable('HOME') + '/Downloads/';
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Music/') then usr_music := GetEnvironmentVariable('HOME') + '/Music/';
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Pictures/') then usr_pictures := GetEnvironmentVariable('HOME') + '/Pictures/';
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Videos/') then usr_videos := GetEnvironmentVariable('HOME') + '/Videos/';
get_home_path(s);
if DirectoryExists(s + 'Documents/') then usr_documents := s + 'Documents/';
if DirectoryExists(s + 'Downloads/') then usr_downloads := s + 'Downloads/';
if DirectoryExists(s + 'Music/') then usr_music := s + 'Music/';
if DirectoryExists(s + 'Pictures/') then usr_pictures := s + 'Pictures/';
if DirectoryExists(s + 'Videos/') then usr_videos := s + 'Videos/';
{$IFDEF DARWIN}
if DirectoryExists(GetEnvironmentVariable('HOME') + '/Movies/') then usr_videos := GetEnvironmentVariable('HOME') + '/Movies/';
if DirectoryExists(s + 'Movies/') then usr_videos := s + 'Movies/';
{$ENDIF}
{$ENDIF}
end;

procedure get_desktop_path(var s: ansistring); //superseded in Windows
begin
get_home_path(s);
{$IFDEF MSWINDOWS}
s := (GetEnvironmentVariable('USERPROFILE') + '\Desktop\');
s := s + 'Desktop\';
{$ENDIF}
{$IFDEF LINUX}
s := GetEnvironmentVariable('HOME') + '/Desktop/';
s := s + 'Desktop/';
{$ENDIF}
{$IFDEF FREEBSD}
s := GetEnvironmentVariable('HOME') + '/Desktop/';
s := s + 'Desktop/';
{$ENDIF}
{$IFDEF NETBSD}
s := GetEnvironmentVariable('HOME') + '/Desktop/';
s := s + 'Desktop/';
{$ENDIF}
{$IFDEF OPENBSD}
s := GetEnvironmentVariable('HOME') + '/Desktop/';
s := s + 'Desktop/';
{$ENDIF}
{$IFDEF DARWIN}
s := GetEnvironmentVariable('HOME') + '/Desktop/';
s := s + 'Desktop/';
{$ENDIF}
if s = '' then get_home_path(s);
if s<>'' then
if s[length(s)] <> directoryseparator then
s := s + directoryseparator;
end;

procedure get_usrtmp_path(var s: ansistring);
//works fine in Windows even if username contains extended characters
begin
s:=GetTempDir;
if s = '' then get_desktop_path(s);
if s<>'' then
if s[length(s)] <> directoryseparator then
s := s + directoryseparator;
setendingdirseparator(s);
end;

function fget_usrtmp_path:ansistring;
Expand Down Expand Up @@ -2285,7 +2296,7 @@ function testinput(infile: ansistring; testdir: boolean): integer;
begin
testinput := 0;//not supported filetype
if testdir = True then
if directoryexists((infile)) then
if checkdirexists(infile) then
testinput := 1000;
i := testext(infile);
if i >= 0 then
Expand Down Expand Up @@ -2480,4 +2491,30 @@ function rLast(dir, mask: ansistring; //last modified time
result := SUCCESS;
end;

function checkdirexists(s:ansistring):boolean;
var s1:ansistring;
begin
result:=true;
if s='' then
begin
result:=false;
exit;
end;
s1:=s;
if not(directoryexists(s1)) then
if s1[length(s1)]=directoryseparator then
begin
setlength(s1,length(s1)-1);
if not(directoryexists(s1)) then result:=false;
end
else result:=false;
end;

function checkfiledirexists(s:ansistring):boolean;
begin
result:=true;
if not(fileexists(s)) then
if not(checkdirexists(s)) then result:=false;
end;

end.
8 changes: 4 additions & 4 deletions peazip-sources/dev/pea.rc
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
MAINICON ICON "peazip.ico"
// Version Info
1 VERSIONINFO
FILEVERSION 1,1,7,0
PRODUCTVERSION 1,1,7,0
FILEVERSION 1,1,8,0
PRODUCTVERSION 1,1,8,0
{
BLOCK "StringFileInfo"
{
BLOCK "040904E4"
{
VALUE "CompanyName", "Giorgio Tani"
VALUE "FileVersion", "1.1.7"
VALUE "FileVersion", "1.1.8"
VALUE "FileDescription", "Pea: pack, encrypt, authenticate"
VALUE "InternalName", "Pea"
VALUE "LegalCopyright", "Giorgio Tani, LGPLv3"
VALUE "LegalTrademarks", "none"
VALUE "OriginalFilename", "Pea"
VALUE "ProductName", "Pea"
VALUE "ProductVersion", "1.1.7"
VALUE "ProductVersion", "1.1.8"
}
}
BLOCK "VarFileInfo"
Expand Down
Binary file modified peazip-sources/dev/pea.res
Binary file not shown.
Loading

0 comments on commit 1a52071

Please sign in to comment.