improved converting URL path delimiter to PathDelim

git-svn-id: trunk@9377 -
This commit is contained in:
mattias 2006-05-30 21:50:42 +00:00
parent 16143c1144
commit ceace70fe8
4 changed files with 40 additions and 6 deletions

View File

@ -11,7 +11,6 @@
</General>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>

View File

@ -189,8 +189,8 @@ begin
URLType:=BaseURLType;
end;
end;
if (URLType='file') and (not FilenameIsUnixAbsolute(URLPath)) then
URLPath:=TrimFilename(GetCurrentDir+PathDelim+URLPath);
if (URLType='file') and (not URLFilenameIsAbsolute(URLPath)) then
URLPath:=FilenameToURLPath(TrimFilename(GetCurrentDir+PathDelim))+URLPath;
if (URLType='file') and (not FileExists(URLPath)) then begin
Result:=shrContextNotFound;

View File

@ -541,6 +541,8 @@ procedure FreeUnusedLCLHelpSystem;
// URL functions
function FilenameToURL(const Filename: string): string;
function FilenameToURLPath(const Filename: string): string;
function URLPathToFilename(const URLPath: string): string;
procedure SplitURL(const URL: string; var URLType, URLPath, URLParams: string);
function CombineURL(const URLType, URLPath, URLParams: string): string;
function URLFilenameIsAbsolute(const Filename: string): boolean;
@ -550,6 +552,7 @@ function ChompURLParams(const URL: string): string;
function ExtractURLPath(const URL: string): string;
function ExtractURLDirectory(const URL: string): string;
function TrimUrl(const URL: string): string;
function TrimURLPath(const URLPath: string): string;
function IsFileURL(const URL: string): boolean;
procedure CreateListAndAdd(const AnObject: TObject; var List: TList;
@ -599,6 +602,32 @@ begin
Result:='file://'+Result;
end;
function FilenameToURLPath(const Filename: string): string;
var
i: Integer;
begin
Result:=Filename;
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]=PathDelim then
Result[i]:='/';
{$warnings on}
end;
function URLPathToFilename(const URLPath: string): string;
var
i: Integer;
begin
Result:=URLPath;
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]='/' then
Result[i]:=PathDelim;
{$warnings on}
end;
procedure SplitURL(const URL: string; var URLType, URLPath, URLParams: string);
var
Len: Integer;
@ -695,7 +724,12 @@ var
URLType, URLPath, URLParams: string;
begin
SplitURL(URL,URLType,URLPath,URLParams);
Result:=CombineURL(URLType,TrimFilename(URLPath),URLParams);
Result:=CombineURL(URLType,TrimURLPath(URLPath),URLParams);
end;
function TrimURLPath(const URLPath: string): string;
begin
Result:=FilenameToURLPath(TrimFilename(URLPathToFilename(URLPath)));
end;
function IsFileURL(const URL: string): boolean;

View File

@ -16,8 +16,9 @@ Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
%description
Lazarus is a free and opensource RAD tool for freepascal using the lazarus
component library - LCL, which is also included in this package.
Lazarus is a free and open source Rapid Application Development tool for
the FreePascal compiler using the Lazarus component library - LCL. The LCL
is included in this package.
%prep
%setup -c