Mailing List
Home
Forum Home
MUD Dev - Discussion of MUD system design, development, and implementation
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Flash Racing
MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Working with XML files/CFURL

Working with XML files/CFURL

2003-11-22       - By Bryan Pietrzak

 Back
Reply:     1     2     3     4     5  

On Nov 21, 2003, at 2:36 AM, m.b. wrote:

> Before I go asking for help on how to use that am I correct in
> assuming that is the best method to get the CFURLRef for a file in my
> filesystem and should I ask this elsewhere?

If you are on OS 9 or later:

Assuming you have an FSSpec:

  FSRef fileRef;
  error = FSpMakeFSRef(&file, &fileRef);
  url = CFURLCreateFromFSRef (kCFAllocatorSystemDefault, &fileRef);

If you must support 8.6 (and therefore can't use FSRefs)


    TextEncoding   systemEncoding;
    Str255       fullpath;
   
    GetFullPathname(&file, fullpath);     (ick, but what are you gonna do?
this is like "mydrive:myfolder:myfile"
                   
    if (UpgradeScriptInfoToTextEncoding == (void *)
kUnresolvedCFragSymbolAddress)      systemEncoding =
kCFStringEncodingMacRoman;
      else
     UpgradeScriptInfoToTextEncoding (GetScriptManagerVariable(
smSysScript), kTextLanguageDontCare, GetScriptManagerVariable(
smRegionCode), NULL, &systemEncoding);

  CFStringRef path = CFStringCreateWithPascalString(NULL, fullpath,
systemEncoding);
     
  url = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, path,
kCFURLHFSPathStyle, false);

  CFRelease(path);

Hope this helps.

Bryan
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
mac-games-dev mailing list | mac-games-dev@(protected)
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac
-games-dev
Do not post admin requests to the list. They will be ignored.

Earn $52 per hosting referral at Lunarpages.