Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

info1686

macrumors newbie
Original poster
Jan 21, 2009
13
0
Hi all,
I am writing a small backup utility in Mac OS X using C.
I am stuck up with aliases and trying to find out how they should be backed up.

I read that the aliases are empty files and they store their content in the resource forks
I also read that aliases need to be handled using the Alias Manager / Carbon API
In order to backup aliases, should it suffice if I read the data and resource forks of the alias and backup them up?

On restoring the alias along with its resource fork, will it again be interpreted as an alias ?

Also, I will be backing up resource forks of all files hence I need not identify aliases seperately
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
Hi all,
I am writing a small backup utility in Mac OS X using C.
I am stuck up with aliases and trying to find out how they should be backed up.

I read that the aliases are empty files and they store their content in the resource forks
I also read that aliases need to be handled using the Alias Manager / Carbon API
In order to backup aliases, should it suffice if I read the data and resource forks of the alias and backup them up?

On restoring the alias along with its resource fork, will it again be interpreted as an alias ?

Also, I will be backing up resource forks of all files hence I need not identify aliases seperately

Copying data fork and resource fork is essential; you also need to copy all the finder flags. That should be enough to turn alias files into alias files. It won't handle symbolic links.
 

info1686

macrumors newbie
Original poster
Jan 21, 2009
13
0
Ok, copying of data and resource forks can be done using the standard API's
But what about the Finder flags?
How do I get their values?

Can I use standard API's or only the Carbon API's?

Why I am asking this is because I feel that use of Carbon API just for aliases is a big overhead

Thanks in advance
 

info1686

macrumors newbie
Original poster
Jan 21, 2009
13
0
I found HFS+ disk format in the file /usr/include/hfs/hfs_format.h
It declares a number of structures giving volume info, block info, finder info etc.
However, it does not declare any API's

So, how am I supposed to use all those structures?
Where can I find the necessary API's?
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
I found HFS+ disk format in the file /usr/include/hfs/hfs_format.h
It declares a number of structures giving volume info, block info, finder info etc.
However, it does not declare any API's

So, how am I supposed to use all those structures?
Where can I find the necessary API's?

In the Carbon framework (or maybe CarbonCore specifically). Mac OS X is not just another Unix OS. If you don't back up all files completely you will break something while trying to restore the files, which kinda defeats the purpose of backing them up to begin with.

I wrote a software installer years ago, it is not just a simple matter of copying files.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.