> Hello,
>
> is MoreFilesX as downloadable from the Net compatible with CW10? When I
> try to compile it, it gives tons of errors from the depths of
> Carbon/Carbon.h.
Should be fine. Can you be more specific about the errors you're
seeing?
Larry
djg@tramontana.co.hu - 07 Jan 2006 13:14 GMT
102 errors, no warnings. The majority is about redefining various
functions, a few of them is Number out of range in various headers
included by Carbon.h included by MoreFilesX.h.
The code itself is very simple, just a quick test:
=====
#include <iostream>
#include "MoreFiles.h"
int main(int argc, char *argv[]) {
#pragma unused(argc, argv)
using namespace std;
char From[255] = "HARD DISK:Applications:Utility:Terminal";
char To[255];
FSMakePath (From, To);
cout << To << endl;
return 0;
}
=====
Actually, this is the only function I'd need, to convert a HFS path
into a Posix one, so I already thought about removing MoreFilesX and
only use the actual function code but I need to dig out the definitions
of FSRefParam and FSRef to do so. This will probably be my next step
unless you can tell me what I'm doing wrong with this... :-)
The project is Mach-O C++ Console Final as CW 10 creates it itself,
plus Carbon.framework added. The environment is OS X 10.3, XCode 1.5
(SDK, DevTools and gcc 3.3). I know that there is a newer version of
XCode but this is what I need (and is sufficient) for the actual
project itself and I really hope this doesn't depend on the version.
Thanks,
Gábor
djg@tramontana.co.hu - 08 Jan 2006 11:40 GMT
For the record: as you pointed out to me that with the functions in
MoreFilesX, there will be different strings (Pascal versus C) used, I
finally settled on using the CFURL functions
CFURLCreateWithFileSystemPath and CFURLCopyFileSystemPath to do the
HFS-POSIX path conversion. It works now.
Thanks,
Gábor
djg@tramontana.co.hu - 07 Jan 2006 14:07 GMT
Mostly various functions redeclared and a few numbers out of range.
As I'd only need a single path conversion function, I also tried to
copy the relevant code into my own program and use that. This one
compiles but doesn't return a POSIX path:
#include <iostream>
#include <Files.h>
void FSMakePath (char* HFSpath, char* POSIXpath) {
FSRefParam pb;
FSRef ref;
pb.ioVRefNum = pb.ioDirID = 0;
pb.ioNamePtr = (StringPtr) HFSpath;
pb.newRef = &ref;
PBMakeFSRefSync (&pb);
FSRefMakePath (&ref, (unsigned char*) POSIXpath, 255);
} // FSMakePath
int main(int argc, char *argv[]) {
#pragma unused(argc, argv)
using namespace std;
char From[255] = "HARD DISK:Applications:Utility:Terminal";
char To[255];
FSMakePath (From, To);
cout << To << endl;
return 0;
}
Bye,
Gábor
Thorsten Froehlich - 08 Jan 2006 21:00 GMT
void FSMakePath (char* HFSpath, char* POSIXpath)
certainly does not look like the version on Apple's webiste at
<http://developer.apple.com/samplecode/MoreFilesX/listing1.html>
Are you sure you are dealing with code from Apple and not some modified
version someone else made?
Thorsten
DEÁK JAHN, Gábor - 09 Jan 2006 09:53 GMT
Thorsten,
> void FSMakePath (char* HFSpath, char* POSIXpath)
> certainly does not look like the version on Apple's webiste at
No, it doesn't. Google Groups played dirty tricks on me, some of my posts were delayed for two days or more, so they finally appeared completely out of sequence here. This was already my modified version where I tried to copy the relevant portions of MoreFilesX into my own code, modifying the arguments as my own case dictated. Sorry for the confusion...
Bye,
Gábor