Changeset 502 for Common


Ignore:
Timestamp:
Jan 22, 2018, 11:01:57 AM (7 years ago)
Author:
chronos
Message:
  • Fixed: Compilation warnings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r493 r502  
    6363procedure OpenWebPage(URL: string);
    6464procedure OpenFileInShell(FileName: string);
    65 procedure ExecuteProgram(CommandLine: string);
     65procedure ExecuteProgram(Executable: string; Parameters: array of string);
    6666procedure FreeThenNil(var Obj);
    6767function RemoveQuotes(Text: string): string;
     
    112112  Path := IncludeTrailingPathDelimiter(APath);
    113113
    114   Find := FindFirst(UTF8Decode(Path + AFileSpec), faAnyFile xor faDirectory, SearchRec);
     114  Find := FindFirst(Path + AFileSpec, faAnyFile xor faDirectory, SearchRec);
    115115  while Find = 0 do begin
    116     DeleteFile(Path + UTF8Encode(SearchRec.Name));
     116    DeleteFile(Path + SearchRec.Name);
    117117
    118118    Find := SysUtils.FindNext(SearchRec);
     
    429429end;
    430430
    431 procedure ExecuteProgram(CommandLine: string);
     431procedure ExecuteProgram(Executable: string; Parameters: array of string);
    432432var
    433433  Process: TProcess;
     434  I: Integer;
    434435begin
    435436  try
    436437    Process := TProcess.Create(nil);
    437     Process.CommandLine := CommandLine;
     438    Process.Executable := Executable;
     439    for I := 0 to Length(Parameters) - 1 do
     440      Process.Parameters.Add(Parameters[I]);
    438441    Process.Options := [poNoConsole];
    439442    Process.Execute;
     
    456459procedure OpenFileInShell(FileName: string);
    457460begin
    458   ExecuteProgram('cmd.exe /c start "' + FileName + '"');
     461  ExecuteProgram('cmd.exe', ['/c', 'start', FileName]);
    459462end;
    460463
Note: See TracChangeset for help on using the changeset viewer.