finatronics (finatronics) wrote in cprogramming,


I'm trying to figure out how to get the original path to a header file as a string in my program for version-control purposes...

I've tried using the predefined __FILE__ macro, but it's only giving me the filename itself "fileInfo.h" and none of the path info. Most important, actually, is the folder name the file is contained within, I don't even care about the filename!

As a quick method for version control, I tend to keep my versions separated by duplicating the folder of the previous version and modifying the folder name to contain the version number and a quick overview of the changes... for instance /Cprojects/FlyingRabbits/123-flyHigher/ contains version 123 of the FlyingRabbits project and what makes it different is that the rabbits fly higher in 123 than in 122... I'm open to suggestions of other methods of version control, but I don't want to have to learn CVS or something, this method has worked perfectly fine for my needs for 5 years and doesn't require any additional software or time-consuming editing of versionInfo.txt documents... The only problem is that I keep forgetting which version numbers are on which microcontrollers, and reading them with a chip reader and having to compare checksums with all my backups is getting to be a pain... Ideally I want to store "FlyingRabbits/123" in the program memory, so I can easily tell what it is using a chip reader...

The odd thing is, I can find a whole bunch of sites claiming that __FILE__ is supposed to be the entire path, but it's obviously not in my case. I'm using [avr-]gcc version 4.1.2

Ideas? Thanks!
  • Post a new comment


    default userpic