by APIJunkie
31. January 2010 11:13
Many times it’s more desirable to collect your post build commands into batch files. Some of the reasons include easier maintenance, portability and satisfying the “don’t repeat principle” when multiple projects are sharing the same commands. If you do decide to go down the batch road there are a couple of things you should be aware of:
1. If you want to run multiple batch files or commands. You will need to use the “call” command to ensure that all the other commands execute. If you don’t do that only the first batch file will run. To use the call command, simply precede each batch file name with “call”.
Example:
Instead of writing:
C:\MyBatchFile.bat
Write:
call C:\MyBatchFile.bat
2. Sometimes you will need to run external programs that could be installed in different locations on different dev machines. In such cases you might find the batch “start” command very useful. Instead of specifying the path, you just use the external program name or its file associations.
Example:
Let’s say you have several developers that have installed Winrar in different locations.
Writing: “C:\XXX\Winrar.exe” in the batch will not work in cases where developers installed it on another drive or location.
But writing: “start winrar” in the batch will work if it’s installed on the developer’s machine.
Hope this helps!
by APIJunkie
22. December 2009 08:05
mkdir is a C runtime library function that creates directories.
In contrary to what could be understood from the MSDN documentation:
“…On an error, the function returns –1 and sets errno as follows.EEXIST Directory was not created because dirname is the name of an existing file, directory, or device.ENOENT Path was not found.For more information about these and other return codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.”
mkdir might return other error values. For example when calling mkdir on an existing directory the function might return EEXIST but can also return EACCES (permission denied). The function error results seem to differ according to user access permissions on the system. This has been tested on Windows 2003/Vista/7. For more information and portability issues check out this discussion about mkdir portability in Kernel trap.
· Note that this discussion applies to Microsoft’s implementation of the C run time library.