IDE: Publish feature: prevent failure when the publish directory is a subfolder of the source directory.

git-svn-id: trunk@58876 -
This commit is contained in:
balazs 2018-09-05 19:25:21 +00:00
parent d049fe0df4
commit ee22bab977
2 changed files with 32 additions and 3 deletions

View File

@ -3877,6 +3877,10 @@ resourcestring
+'comma and semicolon separates alternatives. For example: Simple '
+'syntax *.pas;*.pp corresponds to ^(.*\.pas|.*\.pp)$';
lisUseFilterForExtraFiles = 'Use filter to include extra files';
lisCopyFilesFailed = 'Copying files failed';
lisCopyPackagesFailed = 'Copying packages failed';
lisWriteProjectInfoFailed = 'Writing the project info file failed';
lisWritePackageInfoFailed = 'Writing the package info file failed';
lisIncludeFilter = 'Include filter';
lisInvalidPublishingDirectory = 'Invalid publishing Directory';
lisEmptyDestinationForPublishing = 'Destination directory for publishing'

View File

@ -31,7 +31,7 @@ unit PublishModuleDlg;
// Define this to test publishing to a subdirectory of the project/package dir.
// Now it creates a recursive loop.
{.$define AllowProjectSubDirectory}
{$define AllowProjectSubDirectory}
interface
@ -196,6 +196,11 @@ begin
DebugLn(['DoFileFound: In Backup or Output dir, not copied: ', FileName]);
Exit;
end;
if (CurDir = FDestDir) then
begin
DebugLn(['DoFileFound: The destination directory is in the same folder as the source files, not copied: ', FileName]);
Exit;
end;
if FOptions.FileCanBePublished(FileName) then
begin
if CopyAFile(FileName) <> mrOK then
@ -480,13 +485,32 @@ begin
if FOptions is TPublishProjectOptions then
begin
Result := CopyProjectFiles;
if Result<>mrOk then exit;
if Result <> mrOk then
begin
IDEMessageDialog(lisError, lisCopyFilesFailed, mtInformation,[mbOk]);
exit;
end;
Result := WriteProjectInfo;
if Result <> mrOk then
begin
IDEMessageDialog(lisError, lisWriteProjectInfoFailed, mtInformation,[mbOk]);
exit;
end;
end
else begin
Result := CopyPackageFiles;
if Result<>mrOk then exit;
if Result <> mrOk then
begin
IDEMessageDialog(lisError, lisCopyPackagesFailed, mtInformation,[mbOk]);
exit;
end;
Result := WritePackageInfo;
if Result <> mrOk then
begin
IDEMessageDialog(lisError, lisWritePackageInfoFailed, mtInformation,[mbOk]);
exit;
end;
end;
if Result<>mrOk then exit;
@ -504,6 +528,7 @@ begin
end;
if FCopyFailedCount <> 0 then
begin
IDEMessageDialog(lisError, lisCopyFilesFailed, mtInformation,[mbOk]);
DebugLn('Hint: [TPublisher] Copying files failed');
exit(mrCancel);
end;