Changeset 3399


Ignore:
Timestamp:
Jan 6, 2019, 7:25:12 PM (6 years ago)
Author:
Andreas Schnellbacher
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/netlabs/macros/file.e

    r3368 r3399  
    218218   enddo
    219219   return rc
     220
     221; ---------------------------------------------------------------------------
     222; This can be executed before a file with Filename is created or, when a
     223; file has a temporary name, before it was renamed to Filename.
     224; This is used to keep virtual filenames unique.
     225defc QuitSameFile
     226   Filename = arg( 1)
     227
     228   do once = 1 to 1
     229      if Filename = '' then
     230         leave
     231      endif
     232
     233      -- Check if old file with the same name is already in ring
     234      getfileid OldFid, Filename
     235      if OldFid = '' then
     236         leave
     237      endif
     238
     239      -- Discard previously loaded file from ring
     240      getfileid CurFid
     241      if CurFid = OldFid then
     242         -- Quit current file
     243         'xcom quit'
     244      else
     245         -- Temporarily switch to old file and quit it
     246         activatefile OldFid
     247         'xcom quit'
     248         activatefile CurFid
     249      endif
     250   enddo
    220251
    221252; ---------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.