User VisualStudio PostBuild with place-marker - visual-studio-2010

After successfully build, I want to copy the content of the the folder to the destination.
I've learned that this will work fine:
copy "$(TargetPath)" "$(TargetDir)\..\..\..\TB-Annotation Editor\bin\Debug\Plugins\$(TargetFileName)"
But I am interested to copy all *.exe, all *.dll and all *.txt files into the destination and this could cost a lot of lines for each plugin. Now I wanted to ask if there is any possibility to use place-marker instead of fixed filenames.
this does not work and raise event "Error Code 1"
copy "$(TargetDir)*.*" "$(SolutionDir)bin\Debug\plugins\"
Regards
** Solved except .dll *
I'm very sorry, seems to be not an error because of the "*" but of the folder which is called same twice:
copy "$(TargetDir)*.*" "$(SolutionDir)MyProject\bin\Debug\plugins\"
Goes correct to:
"copy
"C:\Daten Laptop\PAG\Net\MyProject\Solution\Plugins\DSP - Alphablend\bin\Debug\DSP - Alphablend.exe"
"C:\Daten Laptop\PAG\Net\MyProject\Solution\MyProject Main\MyProject Main\bin\Debug\plugins\DSP - Alphablend.exe""
But when using ".dll" instead of ".*" (DLL does not exist, because at the moment it is selected as *.exe) it does throw error code 1 again.

To my mind the best way of doing this is setting file properties and project properties. This requires no additional lines at all. If you set "output folder" property for project, "copy local" flags for referenced libraries and change "Build action" and "Copy to output directory" properties for your txt files (they should be included to solution) you get what you want.

Related

Copy a file in Post Build of Eclipse/Truestudio

I was using arm-objcopy but it doesn't work with my .h file I need to copy to another project.
xcopy "../${project_loc}/src/folder/file.h" "....\OtherProject\folder\folder2\file.h" /Y
The error I get is "Invalid number of parameters". Earlier it was working enough to delete the existing file and ask "Is this File or Directory". /Y is supposed to quiet that according to xcopy docs, but then I find Copy file(s) from one project to another using post build event...VS2010 which suggests otherwise? Either way it didn't let the copy happen quietly.
Project_loc from What are the predefined variables in eclipse?
I would've thought this wouldn't take an hour. Google disagrees with me.
Edit
I flipped the first set of / to \ and now I'm back to
Does ....\Project\folder\folder2\file.h
specify a file name or directory name on the target (F = file, D =
directory)?
xcopy "${ProjDirPath}\src\folder\file.h" "..\..\OtherProject\folder\folder2\file.h" /Y
I had a typo somewhere in the destination, but I used ${ProjDirPath} as ${Project_loc} did not exist for the source.

Can Visual Studio read a set of include file paths from a text file for the Additional Include Directories?

I'm trying to figure out how to get Visual Studio to read a set of include files from a text file.
For example, I would like to create a text file called IncludePaths.txt that contains a list of include paths such as "/I ../../header"
I would then tell Visual Studio reference this file.
I believe you could do this by adding #IncludePaths.txt to the Additional Include Directory, but I cannot get this to work. I have seen this done in projects I have worked on in the past but I can't find any documentation or figure out the trick.
After a little more research and talking to a couple of other developers, I figured out the "trick"
1) Create a file called IncludePaths.txt next to my project file.
2) Add your include paths to this file...
/I "..\..\..\..\open\common\include"
/I "..\..\..\common\include"
/I "..\..\"
3) Go to Properties -> C++ -> Command Line
4) Under "Additional Options" add #IncludePaths.txt
Alternatively, you can use custom properties to get this to work too.

VISUAL STUDIO, MFC PROJECT

I am running a third party sample MFC project:
In the "Output" tab of a successful build, this is shown:
1> MDIBars.vcxproj -> C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy'\'.'\'..\Bin\MDIBarsD.exe
(I had to add two pairs of ' to get it to post correctly)
What does this mean? Specifically, the ".\" & "..\"
I know that .\ is the directory the .sln is in...
I know that ..\ means one up from where the directory the .sln is in...
The directory just before the .\ is the location of the .sln. So it appears there are identical consecutive directories in the file path? It looks recursive.
What am I missing?
The MDIBars Property Pages/Config Properties/Debugging/working directory is C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Bin <\n new line>
The MSVS2013 solution file is here: C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy<\n to make this post clear>
The solution file is called MDIBars.sln
ProjectDir: C:\Program Files (x86)\BCGSoft\BCGControlBarPro\Samples\MDIBars - Copy
Notice they do not have the MDIBars Property Pages/Config Properties/Debugging/working directory where the project .sln file is located.
Any help is appreciated...Thanks,
that is just an artefact of concatenating paths automatically.
. means "current directory", .., as you noted, means "one level up".
c:\xyz\.\abc is the same as c:\xyz\abc and c:\xyz\..\abc reduces to c:\abc (think of it as going to xyz, then one level up and to abc)

VBS Script to locate all files of certain extensions and copy them to a specific destination

I'm making a project out of creating a script to use at work to automate one of our processes.
I'd like the script to check an input for username to search the specified user profile path for any files of .doc,.docx,.pdf,.pst ect. and copy them as is to a created folder on a network drive location.
My main question is what is the command or chain of commands to check folders and sub folders starting at the specified userpath, for JUST files with those extensions and I guess copy them but without getting to a situation where it just copies the same file over and over and over again. Sorry if that's confusing.
This answer provides sample code for recursively traversing a folder tree. A list of extensions could be handled by creating a dictionary:
Set extensions = CreateObject("Scripting.Dictionary")
extensions.CompareMode = vbTextCompare 'case-insensitive
extensions.Add "doc", True
extensions.Add "docx", True
extensions.Add "pdf", True
extensions.Add "pst", True
...
and then checking the extension of the processed files like this:
For Each f In fldr.Files
If extensions.Exists(objFso.GetExtensionName(f.Name)) Then
f.Copy targetFolder & "\"
End If
Next
The trailing backslash is required when the destination is a folder, otherwise you'd have to specify the full target path including the target filename.
I think I have understood most of the requirements, and this can be more easily achieved by using a .BAT file approach within windows. This batch (.Bat) file can run commands such as copy / delete etc.
So create a file called test.bat, and inside the file add the below script:
::XCOPY source [destination]
XCOPY "C:\Temp\*.doc" "C:\Temp\another"
What does this do? Well it uses an XCOPY Command to copy any files within the C:\Temp direcory which have a .doc extension. The files will be copied over to a folder called C:\Temp\another.
The XCOPY takes two primary arguments: source and destination. Source is where the file currently lives, and destination is where you want to copy the files to. More info of all of the options available can be found on:
http://support.microsoft.com/kb/240268
In order to run the file, just double click it, or schedule it to run whenever required.
Let me know if this meets your requirement, I didn't fully understand the bit about an input for a username?

Working in Xcode: Can't find exiftool:Can't locate Image/ExifTool.pm

But it's there.
any ideas?
It happens when I am trying to get metadata from an image file (this is AppleScript running a shell script):
on getMetaData(filePath)
-->get meta data
try
set myCommand to (quoted form of (POSIX path of (pathToExifTool)) & " " & quoted form of (POSIX path of (filePath)))
set thisMetaData to (do shell script myCommand)
on error errMsg
log "Can't find exiftool:" & errMsg
end try
...
pathToExifTool is this:
/Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool"
and exists.
Here's the complete error thrown:
"Can't find exiftool:Can't locate Image/ExifTool.pm in #INC (#INC contains: /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/lib /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30.
BEGIN failed--compilation aborted at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30."
Well the bundle is a mess (lots of .pm files floating about - they look to be duplicates) but the exiftool-->image-->ExifTool.pm path is there.
====================================
Here's the solution h/t to Sherm
Apparently my directory structure went all to hell for some reason, either I did it unknowingly or something with XCode as Sherm indicated decided to wreck havoc. Anyway, (bear with my incredibly non-technical description) when working in XCode, yellow folders (or groups as they call them for some odd reason) will not be added to your bundle...hence exiftool (if you look at the first image) had no hierarchy to find its needed files, as evidenced by the bundle screen capture. I basically trashed all the related exiftool files from the app (right click/delete/delete references) and then brought them back in from the finder. You'll note in the third screen cap those directories are now blue. These will be built with the app.
Have you looked inside your app bundle's Resources/ dir to verify that the directory structure is maintained when you copy these files? IIRC, that doesn't happen automatically; the default behavior is to "flatten" resources, ignoring Xcode groups and simply copying all resource files into the top-level Resources/ directory.
You can avoid the default behavior by removing those groups & file references from your Xcode project - don't delete the files of course! Then, re-add the "lib" directory, taking care to choose the "Create Folder References" option.

Resources