move cwd and cd to private vocabs
parent
9f085cc10a
commit
4acd587629
|
@ -1,6 +1,7 @@
|
|||
USING: alien arrays generic generic.math help.markup help.syntax
|
||||
kernel math memory strings sbufs vectors io io.files classes
|
||||
help generic.standard continuations system debugger.private ;
|
||||
help generic.standard continuations system debugger.private
|
||||
io.files.private ;
|
||||
IN: debugger
|
||||
|
||||
ARTICLE: "errors-assert" "Assertions"
|
||||
|
|
|
@ -197,19 +197,20 @@ HELP: file-contents
|
|||
HELP: cwd
|
||||
{ $values { "path" "a pathname string" } }
|
||||
{ $description "Outputs the current working directory of the Factor process." }
|
||||
{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." } ;
|
||||
{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." }
|
||||
{ $warning "Modifying the current directory through system calls is unsafe. Use the " { $link with-directory } " word instead." } ;
|
||||
|
||||
HELP: cd
|
||||
{ $values { "path" "a pathname string" } }
|
||||
{ $description "Changes the current working directory of the Factor process." }
|
||||
{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." } ;
|
||||
{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." }
|
||||
{ $warning "Modifying the current directory through system calls is unsafe. Use the " { $link with-directory } " word instead." } ;
|
||||
|
||||
{ cd cwd with-directory } related-words
|
||||
{ cd cwd current-directory with-directory } related-words
|
||||
|
||||
HELP: with-directory
|
||||
{ $values { "path" "a pathname string" } { "quot" quotation } }
|
||||
{ $description "Changes the current working directory for the duration of a quotation's execution." }
|
||||
{ $errors "Windows CE has no concept of ``current directory'', so this word throws an error there." } ;
|
||||
{ $description "Changes the " { $link current-directory } " variable for the duration of a quotation's execution. Words that use the file-system should call " { $link normalize-path } " in order to obtain a path relative to the current directory." } ;
|
||||
|
||||
HELP: append-path
|
||||
{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
|
||||
|
|
|
@ -176,15 +176,18 @@ SYMBOL: +unknown+
|
|||
: directory? ( path -- ? )
|
||||
file-info file-info-type +directory+ = ;
|
||||
|
||||
! Current working directory
|
||||
<PRIVATE
|
||||
|
||||
HOOK: cd io-backend ( path -- )
|
||||
|
||||
HOOK: cwd io-backend ( -- path )
|
||||
|
||||
SYMBOL: current-directory
|
||||
|
||||
M: object cwd ( -- path ) "." ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
SYMBOL: current-directory
|
||||
|
||||
[ cwd current-directory set-global ] "io.files" add-init-hook
|
||||
|
||||
: resource-path ( path -- newpath )
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: arrays definitions io kernel math
|
|||
namespaces parser prettyprint sequences strings words
|
||||
editors io.files io.sockets io.streams.byte-array io.binary
|
||||
math.parser io.encodings.ascii io.encodings.binary
|
||||
io.encodings.utf8 ;
|
||||
io.encodings.utf8 io.files.private ;
|
||||
IN: editors.jedit
|
||||
|
||||
: jedit-server-info ( -- port auth )
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
USING: io.backend io.nonblocking io.unix.backend io.files io
|
||||
unix unix.stat unix.time kernel math continuations
|
||||
math.bitfields byte-arrays alien combinators calendar
|
||||
io.encodings.binary accessors sequences strings system ;
|
||||
io.encodings.binary accessors sequences strings system
|
||||
io.files.private ;
|
||||
|
||||
IN: io.unix.files
|
||||
|
||||
<PRIVATE
|
||||
|
||||
M: unix cwd ( -- path )
|
||||
MAXPATHLEN [ <byte-array> ] [ ] bi getcwd
|
||||
[ (io-error) ] unless* ;
|
||||
|
@ -14,6 +17,8 @@ M: unix cwd ( -- path )
|
|||
M: unix cd ( path -- )
|
||||
chdir io-error ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: read-flags O_RDONLY ; inline
|
||||
|
||||
: open-read ( path -- fd )
|
||||
|
|
|
@ -7,7 +7,7 @@ USING: alien alien.c-types generic io kernel math namespaces
|
|||
io.nonblocking parser threads unix sequences
|
||||
byte-arrays io.sockets io.binary io.unix.backend
|
||||
io.streams.duplex io.sockets.impl math.parser continuations libc
|
||||
combinators io.backend io.files system ;
|
||||
combinators io.backend io.files io.files.private system ;
|
||||
IN: io.unix.sockets
|
||||
|
||||
: pending-init-error ( port -- )
|
||||
|
|
|
@ -5,6 +5,8 @@ alien.c-types alien.arrays sequences combinators combinators.lib
|
|||
sequences.lib ascii splitting alien strings assocs namespaces ;
|
||||
IN: io.windows.nt.files
|
||||
|
||||
<PRIVATE
|
||||
|
||||
M: winnt cwd
|
||||
MAX_UNICODE_PATH dup "ushort" <c-array>
|
||||
[ GetCurrentDirectory win32-error=0/f ] keep
|
||||
|
@ -13,6 +15,8 @@ M: winnt cwd
|
|||
M: winnt cd
|
||||
SetCurrentDirectory win32-error=0/f ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: unicode-prefix ( -- seq )
|
||||
"\\\\?\\" ; inline
|
||||
|
||||
|
|
Loading…
Reference in New Issue