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