|
1 | | - r←GetCiderGlobalConfigFileContent;filename;json;qdmx |
| 1 | + r←GetCiderGlobalConfigFileContent;filename;json;qdmx;txt |
2 | 2 | ⍝ Returns a namespace with all settings (if any) in the (optional) global Cider config file. |
3 | | -⍝ Note that the file might not exist or be empty, in which case `⍬` is returned. |
| 3 | +⍝ If the file does not exist it is created. |
4 | 4 | r←⍬ |
5 | 5 | filename←GetCiderGlobalConfigFilename |
6 | | - :If F.IsFile filename |
7 | | - :Trap 0 |
8 | | - json←F.NGET filename |
9 | | - :Else |
10 | | - qdmx←⎕DMX |
11 | | - ('Reading Cider''s global configuration file "',filename,'" failed: ',2⊃qdmx.DM)Assert 0 |
12 | | - :EndTrap |
13 | | - :AndIf 0<≢json |
| 6 | + :If ~F.IsFile filename |
| 7 | + ⍝ Create a global Cider config file with default entries (all comments) |
| 8 | + txt←'' |
| 9 | + txt,←⊂,'{' |
| 10 | + txt,←⊂,' // AskForDirChange: 1,' |
| 11 | + txt,←⊂,' // CheckForDropboxConflicts: 0,' |
| 12 | + txt,←⊂,' // HandleLinkStops: 0,' |
| 13 | + txt,←⊂,' // ExecuteAfterProjectOpen: "",' ⍝ ⎕SE.Path2Function for example |
| 14 | + txt,←⊂,' // ReportGitStatus: 1,' |
| 15 | + txt,←⊂,' // verbose: 0,' |
| 16 | + txt,←⊂,'}' |
| 17 | + (⊂txt)⎕NPUT filename |
| 18 | + :EndIf |
| 19 | + :Trap 0 |
| 20 | + json←⊃F.NGET filename |
| 21 | + :Else |
| 22 | + qdmx←⎕DMX |
| 23 | + ('Reading Cider''s global configuration file "',filename,'" failed: ',2⊃qdmx.DM)Assert 0 |
| 24 | + :EndTrap |
| 25 | + :If 0<≢json |
14 | 26 | :Trap 0 |
15 | | - r←⎕JSON⍠('Dialect' 'JSON5')⊣⊃json |
| 27 | + r←⎕JSON⍠('Dialect' 'JSON5')⊣json |
16 | 28 | :Else |
17 | 29 | qdmx←⎕DMX |
18 | 30 | ('Reading Cider''s global configuration file "',filename,'" failed: ',2⊃qdmx.DM)Assert 0 |
|
0 commit comments