factor/basis/core-foundation/urls/urls.factor

25 lines
828 B
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2014-12-13 19:25:59 -05:00
USING: alien.c-types alien.syntax core-foundation
core-foundation.strings kernel ;
IN: core-foundation.urls
2009-02-22 20:13:08 -05:00
CONSTANT: kCFURLPOSIXPathStyle 0
TYPEDEF: void* CFURLRef
FUNCTION: CFURLRef CFURLCreateWithFileSystemPath ( CFAllocatorRef allocator, CFStringRef filePath, int pathStyle, Boolean isDirectory )
FUNCTION: CFURLRef CFURLCreateWithString ( CFAllocatorRef allocator, CFStringRef string, CFURLRef base )
FUNCTION: CFURLRef CFURLCopyFileSystemPath ( CFURLRef url, int pathStyle )
: <CFFileSystemURL> ( string dir? -- url )
[ <CFString> f over kCFURLPOSIXPathStyle ] dip
CFURLCreateWithFileSystemPath swap CFRelease ;
: <CFURL> ( string -- url )
<CFString>
[ f swap f CFURLCreateWithString ] keep
CFRelease ;