--- a/UnixOperatingSystem.st Tue Feb 28 16:13:30 2017 +0100
+++ b/UnixOperatingSystem.st Tue Feb 28 16:16:06 2017 +0100
@@ -1130,7 +1130,12 @@
ForkFailed := false.
SlowFork := false.
CurrentDirectory := nil.
+
self initializeCodeset.
+ CharacterEncoder initialize.
+ CodesetEncoder := CharacterEncoder encoderFor:Codeset.
+
+ "Modified: / 27-02-2017 / 15:41:37 / stefan"
!
initializeCodeset
@@ -7157,19 +7162,13 @@
"Initialize CodesetEncoder used to encode/decode strings passed to/from
the operating system (like file names, command output, environment ect.).
- NOTE: DO NOT CALL this in #initialize as CharacterEncoder might not yet
- be initialized. Therefore this method is called from CharacterEncoder class>>
- #initialize. Certainly a hack, but class initialization order is undefined,
- so some sort of hack is necessary.
-
- NOTE2: This should be called initializeCodesetEncoder but to make it consistent
- with getCodeset it is getCodesetEncoder
- "
-
- Codeset isNil ifTrue:[self initializeCodeset].
- CodesetEncoder := CharacterEncoder encoderFor: Codeset.
+ NOTE: This should be called initializeCodesetEncoder but to make it consistent
+ with getCodeset it is getCodesetEncoder"
+
+ ^ CodesetEncoder.
"Created: / 23-01-2013 / 09:54:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-02-2017 / 15:43:31 / stefan"
!
getDomainName
@@ -9408,30 +9407,20 @@
so pathNames and command output comes UTF-8 encoded.
(actually, on a mac, it comes utf8-mac encoded)."
- Codeset notNil ifTrue:[
- encodedPathNameOrOutputLine notNil ifTrue:[
- [
- "/ cg: I am not sure, why this shortcut.
- "/ calling the decoder directly should be much faster
- Codeset == #utf8 ifTrue:[
- ^ encodedPathNameOrOutputLine utf8Decoded.
- ].
- "/ Codeset encoder might not yet be initialized, sigh...
- CodesetEncoder isNil ifTrue:[
- self getCodesetEncoder
- ].
- CodesetEncoder notNil ifTrue:[
- ^ CodesetEncoder decodeString: encodedPathNameOrOutputLine
- ].
- ] on:DecodingError do:[:ex|
- "maybe there are old filenames in ISO-8859-x,
- just keep them untranslated"
- ].
- ].
- ].
- ^ encodedPathNameOrOutputLine
+ (encodedPathNameOrOutputLine isNil or:[CodesetEncoder isNil]) ifTrue:[
+ ^ encodedPathNameOrOutputLine.
+ ].
+
+ ^ [
+ CodesetEncoder encodeString:encodedPathNameOrOutputLine.
+ ] on:DecodingError do:[:ex|
+ "maybe there are old filenames in ISO-8859-x,
+ just keep them untranslated"
+ encodedPathNameOrOutputLine
+ ].
"Modified: / 23-01-2013 / 10:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 27-02-2017 / 15:50:36 / stefan"
!
defaultSystemPath
@@ -9526,28 +9515,17 @@
so the pathName has been UTF-8 encoded, before using it in a system call
(actually, on a mac, it has to be utf8-mac encoded)."
- Codeset notNil ifTrue:[
- pathName notNil ifTrue:[
- [
- "/ cg: I am not sure, why this shortcut.
- "/ calling the encoder directly should be much faster
- Codeset == #utf8 ifTrue:[
- ^ pathName utf8Encoded
- ].
- "/ Codeset encoder might not yet be initialized, sigh...
- CodesetEncoder isNil ifTrue:[
- self getCodesetEncoder
- ].
- CodesetEncoder notNil ifTrue:[
- ^ CodesetEncoder encodeString: pathName.
- ].
- ] on:EncodingError do:[:ex|
- "maybe there are old filenames in ISO-8859-x,
- just keep them untranslated"
- ].
- ].
- ].
- ^ pathName
+ (pathName isNil or:[CodesetEncoder isNil]) ifTrue:[
+ ^ pathName.
+ ].
+
+ ^ [
+ CodesetEncoder encodeString: pathName.
+ ] on:EncodingError do:[:ex|
+ "maybe there are old filenames in ISO-8859-x,
+ just keep them untranslated"
+ pathName
+ ].
"
Codeset := #'utf8-mac'.
@@ -9557,6 +9535,7 @@
"
"Modified: / 23-01-2013 / 10:00:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 27-02-2017 / 15:49:32 / stefan"
! !
!UnixOperatingSystem class methodsFor:'private'!