Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Checking for file delete/create results (https://www.kinook.com/Forum/showthread.php?t=1496)

DavidMacLean 01-26-2006 01:29 PM

Checking for file delete/create results
 
Building project step 'Create Release directory'...
A subdirectory or file C:\Foo\Bar already exists.

Building project step 'Empty output directory'...
File C:\Foo\Bar\*.BPL' does not exists


The above results using a RUN PROGRAM action, eg

%DOSCMD% CALL DEL %RELEASEDIR%\*.BPL


It is not an error if the file to be deleted is already deleted. Similarly, it is not an error if the directory to be created already exists.

Yet if I shut off "fail on errors", what happens when there is a real error?

Any advice...? Please and thank you.

kinook 01-26-2006 02:48 PM

For the create case, conditionally build the step only if the folder doesn't exist. See the Create dest dir step of the Recurse.bld sample.

In the delete case, testing here on Windows XP SP2 (with %DOSCMD% resolving to C:\WINDOWS\system32\cmd.exe /C), that command does return a 0 (success) exit code if no matching files are found, but if it does something different in your environment, you could treat a failure with output containing 'does not exist' as success by adding (VBScript) code like this to the step's vbld_StepDone script event function:

If InStr(Application.ExpandMacros("%LASTSTEP_OUTPUT%"), "does not exist") Then
Step.BuildStatus = vbldStepStatSucceeded
End If

See help on script events for more details: http://www.visualbuild.com/Manual/?scriptevents.htm

DavidMacLean 01-27-2006 11:04 AM

Thank you for a prompt and helpful reply


All times are GMT -5. The time now is 10:37 PM.


Copyright © 1999-2023 Kinook Software, Inc.