mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 16:26:13 +02:00
* Patch from Bart B to let TPath.HasValueFileNameChars return index of offending char. Fixes issue #40540
This commit is contained in:
parent
b8036f7173
commit
39d2035db2
@ -173,8 +173,10 @@ type
|
|||||||
class constructor Create;
|
class constructor Create;
|
||||||
class function IsValidPathChar(const AChar: Char): Boolean;
|
class function IsValidPathChar(const AChar: Char): Boolean;
|
||||||
class function IsValidFileNameChar(const AChar: Char): Boolean;
|
class function IsValidFileNameChar(const AChar: Char): Boolean;
|
||||||
class function HasValidPathChars(const aPath: string; const UseWildcards: Boolean = false): Boolean;
|
class function HasValidPathChars(const aPath: string; const UseWildcards: Boolean = false): Boolean; inline;
|
||||||
class function HasValidFileNameChars(const FileName: string; const UseWildcards: Boolean = False): Boolean;
|
class function HasValidPathChars(const aPath: string; out Index: Integer; const UseWildcards: Boolean = false): Boolean;
|
||||||
|
class function HasValidFileNameChars(const FileName: string; const UseWildcards: Boolean = False): Boolean; inline;
|
||||||
|
class function HasValidFileNameChars(const FileName: string; out Index: Integer; const UseWildcards: Boolean = False): Boolean;
|
||||||
class function GetExtendedPrefix(const aPath: string): TPathPrefixType;
|
class function GetExtendedPrefix(const aPath: string): TPathPrefixType;
|
||||||
class function IsDriveRooted(const aPath: string): Boolean;
|
class function IsDriveRooted(const aPath: string): Boolean;
|
||||||
class function IsExtendedPrefixed(const aPath: string): Boolean;
|
class function IsExtendedPrefixed(const aPath: string): Boolean;
|
||||||
@ -505,6 +507,14 @@ end;
|
|||||||
|
|
||||||
class function TPath.HasValidPathChars(const aPath: string;
|
class function TPath.HasValidPathChars(const aPath: string;
|
||||||
const UseWildcards: Boolean): Boolean;
|
const UseWildcards: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
dummy: Integer;
|
||||||
|
begin
|
||||||
|
Result:=TPath.HasValidPathChars(aPath, dummy, UseWildcards);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TPath.HasValidPathChars(const aPath: string;
|
||||||
|
out Index: integer; const UseWildcards: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
P: PChar;
|
P: PChar;
|
||||||
S,I,Len: Integer;
|
S,I,Len: Integer;
|
||||||
@ -521,6 +531,7 @@ begin
|
|||||||
Inc(P,S-1);
|
Inc(P,S-1);
|
||||||
for I:=S to Len do
|
for I:=S to Len do
|
||||||
begin
|
begin
|
||||||
|
Index:=i;
|
||||||
C:=P^;
|
C:=P^;
|
||||||
if CheckWC and (CharInSet(C,['?','*'])) then
|
if CheckWC and (CharInSet(C,['?','*'])) then
|
||||||
exit;
|
exit;
|
||||||
@ -533,6 +544,14 @@ end;
|
|||||||
|
|
||||||
class function TPath.HasValidFileNameChars(const FileName: string;
|
class function TPath.HasValidFileNameChars(const FileName: string;
|
||||||
const UseWildcards: Boolean): Boolean;
|
const UseWildcards: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
dummy: Integer;
|
||||||
|
begin
|
||||||
|
Result:=HasValidFileNameChars(FileName, dummy, UseWildCards);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TPath.HasValidFileNameChars(const FileName: string;
|
||||||
|
out Index: Integer; const UseWildcards: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
P: PChar;
|
P: PChar;
|
||||||
S,I,Len: Integer;
|
S,I,Len: Integer;
|
||||||
@ -549,6 +568,7 @@ begin
|
|||||||
Inc(P,S-1);
|
Inc(P,S-1);
|
||||||
for I:=S to Len do
|
for I:=S to Len do
|
||||||
begin
|
begin
|
||||||
|
Index:=I;
|
||||||
C:=P^;
|
C:=P^;
|
||||||
if CheckWC and (CharInSet(C,['?','*'])) then
|
if CheckWC and (CharInSet(C,['?','*'])) then
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user