class library: DUGen - the server now handles audio-rate inputs correctly
[supercollider.git] / SCClassLibrary / Platform / windows / extString.sc
blob53895f23c4ba58e908c5a0796ab799a5e486e747
1 + String {
2 /*
3                 // used in methodReferences lookup
4         newTextWindow { arg title="Untitled", makeListener=false;
5                 var tempFile, path;
6         //      this.postln;
7                 path = "temp_newTextWindow";
8                 tempFile = File(path, "w");
9                 tempFile.write(this);
10                 tempFile.close;
11                 ^path.openWinTextFile;
12         }
14         openTextFile { arg selectionStart=0, selectionLength=0;
15                 ^this.openWinTextFile(selectionStart, selectionLength);
16         }
18         hackOpenWinTextFile { arg path, rangeStart, rangeSize;
19                 _OpenWinTextFile ;//doc = Document.open(PathName(this).asAbsolutePath , selectionStart, selectionLength);
20         }
22         openWinTextFile{ arg selectionStart=0, selectionLength=0;
23                 //hackOpenWinTextFile(PathName(this).asAbsolutePath , selectionStart, selectionLength); // standardizePath on win32 yet
24                 hackOpenWinTextFile(this, selectionStart, selectionLength);
25         }
27                 // windows expresses absolute paths differently from posix
28         absolutePath {
29                 var first, sep;
30                 sep = thisProcess.platform.pathSeparator;
31                         // 2 styles of absolute path:
32                         // C:\... or \\machine_name\...
33                 if((this[0].isAlpha and: { this[1] == $: and: { this[2] == sep } })
34                                 or: { this[0] == sep and: { this[1] == sep } }) {
35                         ^this
36                 } {
37                                 // let's also try to convert unix-style dirs
38                                 // assume starting from root dir of drive letter where SC is installed
39                         if(this[0] == $/ and: { this[1] != $/ }) {
40                                 ^File.getcwd[..1] ++ this
41                         };
42                                 // currently we can't support this on windows
43                                 // though it would be nice to have a primitive to get the user's home dir
44 //                      if(first == $~){^this.standardizePath};
45                         ^File.getcwd ++ sep ++ this;
46                 }
47         }
51 + PathName {
52         isAbsolutePath {
53                 var     sep = thisProcess.platform.pathSeparator;
54                 ^(fullPath[0].isAlpha and: { fullPath[1] == $: and: { fullPath[2] == sep } })
55                                 or: { fullPath[0] == sep and: { fullPath[1] == sep } }
56                                 or: { fullPath[0] == $/ and: { fullPath[1] != $/ } }
57         }