Skip to content

Commit f3093d2

Browse files
authored
Merge pull request #372 from Dyalog/v3dev
Version 3.0.4
2 parents c05e02d + 4bcae64 commit f3093d2

File tree

5 files changed

+46
-10
lines changed

5 files changed

+46
-10
lines changed

StartupSession/Link/Notify.aplf

+4-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
:If (0<≢curname)∧(curname≢affected) ⍝ name changed
120120
⎕EX curname ⋄ msg,←' deleting previously defined 'curname
121121
:EndIf
122-
:ElseIf (0≠⎕NC affected)∧(0≠≢curfile) ⍝ name was tied to a different file
122+
:ElseIf (0≠⎕NC affected)∧(0≠≢curfile)∧(⎕C curfile)≢⎕C path ⍝ name was tied to a different file
123123
warn←1 ⋄ name←'' ⋄ →END⊣msg,←'ignoring attempt to redefine 'affected' which is linked to 'curfile
124124
:ElseIf ~curnc∊0 ¯1 ⍝ file already tied to a name
125125
⎕EX curname ⍝ delete name in case the name defined by source has changed
@@ -193,10 +193,12 @@
193193
:If link.fastLoad<(link.forceFilenames∨link.forceExtensions) ⍝ fastLoad is disabled in Notify
194194
:AndIf path≢exppath←expfile(link.forceFilenames U.MergeFileName link.forceExtensions)path
195195
:If ⎕NEXISTS exppath ⍝ would clash with existing file - do not dare fixing
196+
:AndIf (⎕C path)≢⎕C exppath ⍝ Not just a case change
196197
warn←1 ⋄ name←'' ⋄ →END⊣msg,←' - file clash: cannot move file to existing 'exppath' - cannot fix 'affected
197198
:Else
198199
msg,←' - moving to 'exppath
199-
exppath ⎕NMOVE path ⋄ path←exppath
200+
(,⊂exppath) U.Relocate ,⊂path
201+
path←exppath
200202
⍝ If we do the line below, then occasionally the watcher fails to callback on move, making the new file definition not fixed
201203
⍝→END U.If 'dir' 'both'∊⍨⊂link.watch ⍝ file watcher will take care of the rest
202204
:While ~⎕NEXISTS exppath ⋄ ⎕DL 0.000001 ⋄ :EndWhile ⍝ ensure file effectively moved before fixing

StartupSession/Link/Test.dyalog

+25-3
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,31 @@
761761

762762

763763

764-
765-
766-
764+
oktest_forcefilenames(folder name);z;ns;foo;goo;goofile
765+
Test that forceFilenames is handled
766+
767+
name ⎕NS ''
768+
z'{forceFilenames:1}' ⎕SE.Link.Create name folder
769+
ns#name
770+
771+
Create a monadic function
772+
_(foo' r←foo x' ' x x')QNPUT folder,'/foo.aplf'
773+
assert'foo≡ns.⎕NR ''foo''' 'ns.⎕FX ↑foo'
774+
775+
Rename the function to goo
776+
_(goo' r←goo x' ' x x')QNPUT (folder,'/foo.aplf') 1
777+
assert '⎕NEXISTS folder,''//goo.aplf'''
778+
assert'goo≡ns.⎕NR ''goo''' 'ns.⎕FX ↑goo'
779+
780+
Rename case ONLY (see issue #369)
781+
_(goo' r←Goo x' ' x x')QNPUT (folder,'/goo.aplf') 1
782+
goofilefolder,'/Goo.aplf'
783+
assert 'goofile≡⊃⊃0 (⎕NINFO⍠1) folder,''/Goo.*'''
784+
assert'goo≡ns.⎕NR ''Goo''' 'ns.⎕FX ↑goo'
785+
786+
CleanUp folder name
787+
ok1
788+
767789

768790

769791

StartupSession/Link/Utils.apln

+12-2
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,23 @@
295295
:EndIf
296296
297297

298-
∇ {r}←to Relocate from;i;nextfrom;nextto
298+
∇ {r}←to Relocate from;i;nextfrom;nextto;tmpfile
299299
⍝ move list of files, updating file names as we go through the list
300300
r←⍬
301301
:While ~0∊⍴to
302302
(nextto nextfrom)←⊃¨(to from) ⋄ (to from)↓⍨←1
303303
:If nextto≢nextfrom
304-
r,←nextto ⎕NMOVE nextfrom
304+
:Trap 22
305+
r,←nextto ⎕NMOVE nextfrom
306+
:Else ⍝ Suspect issue with case sensitive file system
307+
:If (⎕C nextto)≡⎕C nextfrom ⍝ Names differ only in case
308+
tmpfile←(739⌶0),'/Utils.Relocate_',(' '~⍨⍕⎕TS),'.linktmp'
309+
tmpfile ⎕NMOVE nextfrom ⍝ Must move file out of current folder
310+
r,←nextto ⎕NMOVE tmpfile ⍝ And then recreate with new casing
311+
:Else
312+
⎕DMX.Message ⎕SIGNAL ⎕EN
313+
:EndIf
314+
:EndTrap
305315
from←(nextfrom ⎕R nextto)from ⍝ update directories in particular
306316
:Else ⋄ r,←1 ⍝ no need to copy
307317
:EndIf

StartupSession/Link/Version.aplf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version←Version
2-
version←'3.0.3'
2+
version←'3.0.4'

StartupSession/Link/Watcher.apln

+4-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@
184184
⍝ everything will freeze
185185

186186
:Trap 0
187-
fsw.Dispose
188-
:Else
187+
:If 0≠⎕NC ⊂'fsw.Dispose' ⍝ Don't bother if it is already gone
188+
fsw.Dispose
189+
:EndIf
190+
:Else
189191
##.U.Warn 'Trapped error disposing of FSW on ',nsname,' ',⊃⎕DMX.DM
190192
:EndTrap
191193

0 commit comments

Comments
 (0)