1128 LastErrorNumber := nil. |
1128 LastErrorNumber := nil. |
1129 PipeFailed := false. |
1129 PipeFailed := false. |
1130 ForkFailed := false. |
1130 ForkFailed := false. |
1131 SlowFork := false. |
1131 SlowFork := false. |
1132 CurrentDirectory := nil. |
1132 CurrentDirectory := nil. |
|
1133 |
1133 self initializeCodeset. |
1134 self initializeCodeset. |
|
1135 CharacterEncoder initialize. |
|
1136 CodesetEncoder := CharacterEncoder encoderFor:Codeset. |
|
1137 |
|
1138 "Modified: / 27-02-2017 / 15:41:37 / stefan" |
1134 ! |
1139 ! |
1135 |
1140 |
1136 initializeCodeset |
1141 initializeCodeset |
1137 "initialize the codeset, we are running under. |
1142 "initialize the codeset, we are running under. |
1138 The codeset is determined from the environment. |
1143 The codeset is determined from the environment. |
7155 |
7160 |
7156 getCodesetEncoder |
7161 getCodesetEncoder |
7157 "Initialize CodesetEncoder used to encode/decode strings passed to/from |
7162 "Initialize CodesetEncoder used to encode/decode strings passed to/from |
7158 the operating system (like file names, command output, environment ect.). |
7163 the operating system (like file names, command output, environment ect.). |
7159 |
7164 |
7160 NOTE: DO NOT CALL this in #initialize as CharacterEncoder might not yet |
7165 NOTE: This should be called initializeCodesetEncoder but to make it consistent |
7161 be initialized. Therefore this method is called from CharacterEncoder class>> |
7166 with getCodeset it is getCodesetEncoder" |
7162 #initialize. Certainly a hack, but class initialization order is undefined, |
7167 |
7163 so some sort of hack is necessary. |
7168 ^ CodesetEncoder. |
7164 |
|
7165 NOTE2: This should be called initializeCodesetEncoder but to make it consistent |
|
7166 with getCodeset it is getCodesetEncoder |
|
7167 " |
|
7168 |
|
7169 Codeset isNil ifTrue:[self initializeCodeset]. |
|
7170 CodesetEncoder := CharacterEncoder encoderFor: Codeset. |
|
7171 |
7169 |
7172 "Created: / 23-01-2013 / 09:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7170 "Created: / 23-01-2013 / 09:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
7171 "Modified: / 27-02-2017 / 15:43:31 / stefan" |
7173 ! |
7172 ! |
7174 |
7173 |
7175 getDomainName |
7174 getDomainName |
7176 "return the domain this host is in. |
7175 "return the domain this host is in. |
7177 Notice: |
7176 Notice: |
9406 |
9405 |
9407 E.g. linux system calls return single byte strings only, |
9406 E.g. linux system calls return single byte strings only, |
9408 so pathNames and command output comes UTF-8 encoded. |
9407 so pathNames and command output comes UTF-8 encoded. |
9409 (actually, on a mac, it comes utf8-mac encoded)." |
9408 (actually, on a mac, it comes utf8-mac encoded)." |
9410 |
9409 |
9411 Codeset notNil ifTrue:[ |
9410 (encodedPathNameOrOutputLine isNil or:[CodesetEncoder isNil]) ifTrue:[ |
9412 encodedPathNameOrOutputLine notNil ifTrue:[ |
9411 ^ encodedPathNameOrOutputLine. |
9413 [ |
|
9414 "/ cg: I am not sure, why this shortcut. |
|
9415 "/ calling the decoder directly should be much faster |
|
9416 Codeset == #utf8 ifTrue:[ |
|
9417 ^ encodedPathNameOrOutputLine utf8Decoded. |
|
9418 ]. |
|
9419 "/ Codeset encoder might not yet be initialized, sigh... |
|
9420 CodesetEncoder isNil ifTrue:[ |
|
9421 self getCodesetEncoder |
|
9422 ]. |
|
9423 CodesetEncoder notNil ifTrue:[ |
|
9424 ^ CodesetEncoder decodeString: encodedPathNameOrOutputLine |
|
9425 ]. |
|
9426 ] on:DecodingError do:[:ex| |
|
9427 "maybe there are old filenames in ISO-8859-x, |
|
9428 just keep them untranslated" |
|
9429 ]. |
|
9430 ]. |
|
9431 ]. |
9412 ]. |
9432 ^ encodedPathNameOrOutputLine |
9413 |
|
9414 ^ [ |
|
9415 CodesetEncoder encodeString:encodedPathNameOrOutputLine. |
|
9416 ] on:DecodingError do:[:ex| |
|
9417 "maybe there are old filenames in ISO-8859-x, |
|
9418 just keep them untranslated" |
|
9419 encodedPathNameOrOutputLine |
|
9420 ]. |
9433 |
9421 |
9434 "Modified: / 23-01-2013 / 10:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9422 "Modified: / 23-01-2013 / 10:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9423 "Modified (format): / 27-02-2017 / 15:50:36 / stefan" |
9435 ! |
9424 ! |
9436 |
9425 |
9437 defaultSystemPath |
9426 defaultSystemPath |
9438 "add additional directories to the systemPath |
9427 "add additional directories to the systemPath |
9439 (but only, if the major version is the same)" |
9428 (but only, if the major version is the same)" |
9524 "encode the pathName for use with system calls. |
9513 "encode the pathName for use with system calls. |
9525 E.g. linux system calls accept single byte strings only, |
9514 E.g. linux system calls accept single byte strings only, |
9526 so the pathName has been UTF-8 encoded, before using it in a system call |
9515 so the pathName has been UTF-8 encoded, before using it in a system call |
9527 (actually, on a mac, it has to be utf8-mac encoded)." |
9516 (actually, on a mac, it has to be utf8-mac encoded)." |
9528 |
9517 |
9529 Codeset notNil ifTrue:[ |
9518 (pathName isNil or:[CodesetEncoder isNil]) ifTrue:[ |
9530 pathName notNil ifTrue:[ |
9519 ^ pathName. |
9531 [ |
|
9532 "/ cg: I am not sure, why this shortcut. |
|
9533 "/ calling the encoder directly should be much faster |
|
9534 Codeset == #utf8 ifTrue:[ |
|
9535 ^ pathName utf8Encoded |
|
9536 ]. |
|
9537 "/ Codeset encoder might not yet be initialized, sigh... |
|
9538 CodesetEncoder isNil ifTrue:[ |
|
9539 self getCodesetEncoder |
|
9540 ]. |
|
9541 CodesetEncoder notNil ifTrue:[ |
|
9542 ^ CodesetEncoder encodeString: pathName. |
|
9543 ]. |
|
9544 ] on:EncodingError do:[:ex| |
|
9545 "maybe there are old filenames in ISO-8859-x, |
|
9546 just keep them untranslated" |
|
9547 ]. |
|
9548 ]. |
|
9549 ]. |
9520 ]. |
9550 ^ pathName |
9521 |
|
9522 ^ [ |
|
9523 CodesetEncoder encodeString: pathName. |
|
9524 ] on:EncodingError do:[:ex| |
|
9525 "maybe there are old filenames in ISO-8859-x, |
|
9526 just keep them untranslated" |
|
9527 pathName |
|
9528 ]. |
9551 |
9529 |
9552 " |
9530 " |
9553 Codeset := #'utf8-mac'. |
9531 Codeset := #'utf8-mac'. |
9554 CodesetEncoder := nil. |
9532 CodesetEncoder := nil. |
9555 OperatingSystem getCodesetEncoder |
9533 OperatingSystem getCodesetEncoder |
9556 OperatingSystem encodePath:'äöü' |
9534 OperatingSystem encodePath:'äöü' |
9557 " |
9535 " |
9558 |
9536 |
9559 "Modified: / 23-01-2013 / 10:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9537 "Modified: / 23-01-2013 / 10:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9538 "Modified: / 27-02-2017 / 15:49:32 / stefan" |
9560 ! ! |
9539 ! ! |
9561 |
9540 |
9562 !UnixOperatingSystem class methodsFor:'private'! |
9541 !UnixOperatingSystem class methodsFor:'private'! |
9563 |
9542 |
9564 mountPointsFromProcFS |
9543 mountPointsFromProcFS |