tools: installer: fix copying IDF to a destination on another drive
Closes https://github.com/espressif/esp-idf/issues/4128 Closes https://github.com/espressif/esp-idf/issues/4744
This commit is contained in:
parent
7a18f02acd
commit
b67a7f48a9
2 changed files with 12 additions and 18 deletions
|
@ -87,7 +87,7 @@ begin
|
||||||
CmdLine := GitExecutablePath + ' -C ' + Path + ' submodule foreach git repack -d -a'
|
CmdLine := GitExecutablePath + ' -C ' + Path + ' submodule foreach git repack -d -a'
|
||||||
DoCmdlineInstall('Finishing ESP-IDF installation', 'Re-packing the submodules', CmdLine);
|
DoCmdlineInstall('Finishing ESP-IDF installation', 'Re-packing the submodules', CmdLine);
|
||||||
|
|
||||||
FindFileRecusive(Path + '\.git', 'alternates', @RemoveAlternatesFile);
|
FindFileRecursive(Path + '\.git', 'alternates', @RemoveAlternatesFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Run git reset --hard in the repo and in the submodules, to fix the newlines. }
|
{ Run git reset --hard in the repo and in the submodules, to fix the newlines. }
|
||||||
|
@ -122,7 +122,6 @@ var
|
||||||
IDFTempPath: String;
|
IDFTempPath: String;
|
||||||
IDFPath: String;
|
IDFPath: String;
|
||||||
NeedToClone: Boolean;
|
NeedToClone: Boolean;
|
||||||
Res: Boolean;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
IDFPath := IDFDownloadPath;
|
IDFPath := IDFDownloadPath;
|
||||||
|
@ -168,7 +167,7 @@ begin
|
||||||
GitRepoDissociate(IDFPath);
|
GitRepoDissociate(IDFPath);
|
||||||
|
|
||||||
end else begin
|
end else begin
|
||||||
Log('Moving ' + IDFTempPath + ' to ' + IDFPath);
|
Log('Copying ' + IDFTempPath + ' to ' + IDFPath);
|
||||||
if DirExists(IDFPath) then
|
if DirExists(IDFPath) then
|
||||||
begin
|
begin
|
||||||
if not DirIsEmpty(IDFPath) then
|
if not DirIsEmpty(IDFPath) then
|
||||||
|
@ -176,21 +175,16 @@ begin
|
||||||
MsgBox('Destination directory exists and is not empty: ' + IDFPath, mbError, MB_OK);
|
MsgBox('Destination directory exists and is not empty: ' + IDFPath, mbError, MB_OK);
|
||||||
RaiseException('Failed to copy ESP-IDF')
|
RaiseException('Failed to copy ESP-IDF')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Res := RemoveDir(IDFPath);
|
|
||||||
if not Res then
|
|
||||||
begin
|
|
||||||
MsgBox('Failed to remove destination directory: ' + IDFPath, mbError, MB_OK);
|
|
||||||
RaiseException('Failed to copy ESP-IDF')
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Res := RenameFile(IDFTempPath, IDFPath);
|
|
||||||
if not Res then
|
|
||||||
begin
|
|
||||||
MsgBox('Failed to copy ESP-IDF to the destination directory: ' + IDFPath, mbError, MB_OK);
|
|
||||||
RaiseException('Failed to copy ESP-IDF');
|
|
||||||
end;
|
end;
|
||||||
|
{ If cmd.exe command argument starts with a quote, the first and last quote chars in the command
|
||||||
|
will be removed by cmd.exe.
|
||||||
|
Keys explanation: /s+/e includes all subdirectories, /i assumes that destination is a directory,
|
||||||
|
/h copies hidden files, /q disables file name logging (making copying faster!)
|
||||||
|
}
|
||||||
|
CmdLine := ExpandConstant('cmd.exe /c ""xcopy" /s /e /i /h /q "' + IDFTempPath + '" "' + IDFPath + '""');
|
||||||
|
DoCmdlineInstall('Extracting ESP-IDF', 'Copying ESP-IDF into the destination directory', CmdLine);
|
||||||
GitRepoFixNewlines(IDFPath);
|
GitRepoFixNewlines(IDFPath);
|
||||||
|
DelTree(IDFTempPath, True, True, True);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ end;
|
||||||
type
|
type
|
||||||
TFindFileCallback = procedure(Filename: String);
|
TFindFileCallback = procedure(Filename: String);
|
||||||
|
|
||||||
procedure FindFileRecusive(Directory: string; FileName: string; Callback: TFindFileCallback);
|
procedure FindFileRecursive(Directory: string; FileName: string; Callback: TFindFileCallback);
|
||||||
var
|
var
|
||||||
FindRec: TFindRec;
|
FindRec: TFindRec;
|
||||||
FilePath: string;
|
FilePath: string;
|
||||||
|
@ -107,7 +107,7 @@ begin
|
||||||
FilePath := Directory + '\' + FindRec.Name;
|
FilePath := Directory + '\' + FindRec.Name;
|
||||||
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then
|
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then
|
||||||
begin
|
begin
|
||||||
FindFileRecusive(FilePath, FileName, Callback);
|
FindFileRecursive(FilePath, FileName, Callback);
|
||||||
end else if CompareText(FindRec.Name, FileName) = 0 then
|
end else if CompareText(FindRec.Name, FileName) = 0 then
|
||||||
begin
|
begin
|
||||||
Callback(FilePath);
|
Callback(FilePath);
|
||||||
|
|
Loading…
Reference in a new issue