1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax kernel core-foundation.strings
5 IN: core-foundation.urls
7 CONSTANT: kCFURLPOSIXPathStyle 0
9 TYPEDEF: void* CFURLRef
11 FUNCTION: CFURLRef CFURLCreateWithFileSystemPath ( CFAllocatorRef allocator, CFStringRef filePath, int pathStyle, Boolean isDirectory ) ;
13 FUNCTION: CFURLRef CFURLCreateWithString ( CFAllocatorRef allocator, CFStringRef string, CFURLRef base ) ;
15 FUNCTION: CFURLRef CFURLCopyFileSystemPath ( CFURLRef url, int pathStyle ) ;
17 : <CFFileSystemURL> ( string dir? -- url )
18 [ <CFString> f over kCFURLPOSIXPathStyle ] dip
19 CFURLCreateWithFileSystemPath swap CFRelease ;
21 : <CFURL> ( string -- url )
23 [ f swap f CFURLCreateWithString ] keep