Changeset 4790
- Timestamp:
- Nov 21, 2021, 11:30:24 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/netlabs/macros/file.e ¶
r4789 r4790 172 172 173 173 ; --------------------------------------------------------------------------- 174 ; Handle special NEPMD dirs: don't overwrite files of the NETLABS, EPMBBS or174 ; Handles special NEPMD dirs: don't overwrite files of the NETLABS, EPMBBS or 175 175 ; NETLABS src tree 176 --defproc SaveProcessNetlabsFile( var Filename, var fNameChanged)177 176 defproc SaveProcessNetlabsFile( Filename) 178 177 rc = 0 … … 281 280 282 281 ; --------------------------------------------------------------------------- 283 ; This can be executed after a file with Filename is created. Is has to be284 ; on top.282 ; This can be executed after a file with Filename is created. The file to 283 ; quit must be on top. 285 284 ; This is used to keep virtual filenames unique. 286 285 defc QuitSameFile … … 320 319 321 320 ; --------------------------------------------------------------------------- 321 ; Saves current file. 322 ; If a filename is specified, the current file is saved to the specified 323 ; filename and the current file isn't changed. To achieve that, Name should 324 ; be executed before. 325 ; If, for a temp. file, no filename is specified, the Save-as dialog is 326 ; opened to enter a filename. 327 ; Instead of a filename a longname may be specified. The longname is then 328 ; converted to a filename and after save, the longname is added, if 329 ; different from filename. 330 ; If a <filename> equal to current file is specified, the check for an 331 ; existing file to overwrite is bypassed. 322 332 ; Syntax: 323 333 ; Save save … … 326 336 ; Name <filename> followed by Save save, change to new filename 327 337 ; call Save( <filename>, 1) used by SaveAs 328 ; If <filename> is specified, the check for an existing file to overwrite is329 ; bypassed.330 338 defc Save, s 331 339 Filename = StripQuotesFileSpec( arg( 1)) … … 782 790 783 791 ; --------------------------------------------------------------------------- 784 ; Returns a unique filename on non-FATfile systems for a passed filename.792 ; Returns a unique filename on OS/2 file systems for a passed filename. 785 793 ; Syntax: 786 794 ; UniqueFilename = MakeUniqueFilename( [Filename]) … … 869 877 870 878 ; --------------------------------------------------------------------------- 871 ; Returns a name valid for OS/2 file systems, similar to how OS/2 would 872 ; convert it. It accepts a filename or a drive as arg( 2) to determine the 873 ; filesystem first. It defaults to the current filename. 879 ; Converts a longname to a filename. Returns a name valid for OS/2 file 880 ; systems, similar to how OS/2 would convert it. It accepts a filename or a 881 ; drive as arg( 2) to determine the filesystem first. It defaults to the 882 ; current filename. 874 883 ; Syntax: 875 884 ; ShortName = MakeFilename( [Longname [, FileSpec]]) … … 953 962 954 963 ; --------------------------------------------------------------------------- 955 ; Enquote FileSpec if required.964 ; Enquotes FileSpec if required. 956 965 defproc EnquoteFileSpec( FileSpec) 957 966 if (not (leftstr( FileSpec, 1) = '"' & rightstr( FileSpec, 1) = '"')) & … … 963 972 964 973 ; --------------------------------------------------------------------------- 965 ; Remove double quotes from enquoted strings.974 ; Removes double quotes from enquoted strings. 966 975 defproc StripQuotesFileSpec( FileSpec) 967 976 if leftstr( FileSpec, 1) = '"' & rightstr( FileSpec, 1) = '"' & … … 1008 1017 ; --------------------------------------------------------------------------- 1009 1018 ; Syntax: SaveAll 1010 ; Save all files of the ring. Discard non-modified and temp files. Reset1011 ; .modify for temp files. Bring unnamed files to the top.1019 ; Saves all files of the ring. Discards non-modified and temp files. Resets 1020 ; .modify for temp files. Brings unnamed files to the top. 1012 1021 defc SaveAll 1013 1022 do once = 1 to 1 … … 1225 1234 1226 1235 ; --------------------------------------------------------------------------- 1236 ; Checks if a Longname exists in a Dir. If yes, the file dialog is opened to 1237 ; enter another longname. Sets rc. Returns NewFilename. Loops until a 1238 ; non-existant longname is entered or on Cancel. 1239 ; rc = -5 NewLongFilename = '' Cancel or error 1240 ; rc = 0 NewLongFilename = '' Yes pressed or not found, overwrite 1241 ; rc = 1 NewLongFilename = '...' No pressed and NewLongFilename selected 1242 ; LongFilename means here: Longname with a prepended path, similar to a 1243 ; fully-qualified filename. 1227 1244 defproc SaveAsCheckLongnameExist( Longname, Dir) 1228 1245 NewLongFilename = '' … … 1291 1308 1292 1309 ; --------------------------------------------------------------------------- 1293 -- TODO: Add arg( 2) = fCheckLongname1294 1310 ; Checks if a file exists. If yes, the file dialog is opened to enter another 1295 1311 ; filename. Sets rc. Returns NewFilename. Loops until a non-existant filename … … 1800 1816 1801 1817 ; --------------------------------------------------------------------------- 1802 ; Lock file only if modified, unlockif .modify = 01818 ; Locks file only if modified, unlocks if .modify = 0 1803 1819 ; Todo: disable this if it failed once and for slow drives. 1804 1820 defmodify … … 1814 1830 endif 1815 1831 endif 1816 -- sayerror '.modify = '.modify', .lockhandle = '.lockhandle', .readonly = '.readonly1817 1818 ; --------------------------------------------------------------------------- 1819 ; Can be used to toggle the lock state 1832 --dprintf( '.modify = '.modify', .lockhandle = '.lockhandle', .readonly = '.readonly) 1833 1834 ; --------------------------------------------------------------------------- 1835 ; Can be used to toggle the lock state. 1820 1836 defc lock_on_modify 1821 1837 if wordpos( upcase( arg( 1)), '0 OFF') then … … 1911 1927 if result then 1912 1928 if result = 32 then 1913 sayerrorACCESS_DENIED__MSG '-' MAYBE_LOCKED__MSG' rc = ERROR_SHARING_VIOLATION.'1929 'SayError 'ACCESS_DENIED__MSG '-' MAYBE_LOCKED__MSG' rc = ERROR_SHARING_VIOLATION.' 1914 1930 return result 1915 1931 elseif result = 206 then -- 206 = ERROR_FILENAME_EXCED_RANGE … … 1946 1962 getfileid fileid, file 1947 1963 if fileid == '' then 1948 sayerror '"'file'"' DOES_NOT_EXIST__MSG1964 'SayError "'file'"' DOES_NOT_EXIST__MSG 1949 1965 return 1 1950 1966 endif … … 1955 1971 defproc Unlock( fileid) 1956 1972 if fileid.lockhandle = 0 then 1957 sayerrorfileid.filename NOT_LOCKED__MSG1973 'SayError 'fileid.filename NOT_LOCKED__MSG 1958 1974 return 1 1959 1975 endif 1960 1976 result = dynalink32( 'DOSCALLS', -- Free the original handle 1961 '#257', -- dos32close1977 '#257', -- Dos32Close 1962 1978 atol( fileid.lockhandle), 2) 1963 1979 if result then 1964 sayerror 'DOSCLOSE'ERROR_NUMBER__MSG result1980 'SayError DosClose 'ERROR_NUMBER__MSG result 1965 1981 else 1966 1982 fileid.lockhandle = 0 … … 1978 1994 'xcom e /c 'EnquoteFileSpec( Name) 1979 1995 if rc <> -282 then -- -282 = sayerror( "New file") 1980 sayerrorERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)1996 'SayError 'ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc) 1981 1997 leave 1982 1998 endif … … 2228 2244 2229 2245 ; --------------------------------------------------------------------------- 2230 ; Determine .readonly field from file attribute, if enabled2246 ; Determines .readonly field from file attribute, if enabled. 2231 2247 defc ReadonlyFromAttrib 2232 2248 KeyPath = '\NEPMD\User\Readonly' … … 2291 2307 2292 2308 ; --------------------------------------------------------------------------- 2293 ; Change drive. Release previous directory first (changeto root dir).2294 ; Accept drives and dirs as arg.2309 ; Changes drive. Releases previous directory first (changes to root dir). 2310 ; Accepts drives and dirs as arg. 2295 2311 defproc ChDrive 2296 2312 NewDir = arg( 1) … … 2321 2337 2322 2338 ; --------------------------------------------------------------------------- 2323 ; Change drive and directory. Release previous directory first (changeto2339 ; Changes drive and directory. Releases previous directory first (changes to 2324 2340 ; root dir). 2325 2341 ; This should be used e.g. to change the directory on every defselect. … … 2339 2355 2340 2356 ; --------------------------------------------------------------------------- 2341 ; Change drive and directory. Release previous directory first (changeto2357 ; Changes drive and directory. Releases previous directory first (changes to 2342 2358 ; root dir). This should be used e.g. to change the directory on every 2343 2359 ; defselect. Compared to Directory2, the 'cd' command is used to display … … 2362 2378 2363 2379 ; --------------------------------------------------------------------------- 2364 ; Change drive and directory. If a filename was specified, the directory of2380 ; Changes drive and directory. If a filename was specified, the directory of 2365 2381 ; that file is used instead. 2366 2382 defc xcd … … 2386 2402 2387 2403 ; --------------------------------------------------------------------------- 2388 ; Change drive and directory. Release previous directory first (changeto2389 ; root dir). Give a message.2404 ; Changes drive and directory. Releases previous directory first (changes to 2405 ; root dir). Gives a message. 2390 2406 defc CDDlg 2391 2407 CurDir = directory() … … 2412 2428 2413 2429 ; --------------------------------------------------------------------------- 2414 ; Helper to set startup dir for WPSobjects.2430 ; Helper to set startup dir for EPM program objects. 2415 2431 defc StartupDirDlg 2416 2432 KeyPath = '\NEPMD\User\ProgramObjects\StartupDir' … … 2447 2463 Filename = Filename\0 2448 2464 rc = dynalink32( 'DOSCALLS', -- dynamic link library name 2449 '#259', -- ordinal value for D OSDELETE2465 '#259', -- ordinal value for Dos32Delete 2450 2466 address( Filename)) 2451 2467 return … … 2696 2712 address( BytesReadL), 2) -- Bytes read 2697 2713 if rc then 2698 sayerror 'DosRead' ERROR__MSG rc2714 'SayError DosRead' ERROR__MSG rc 2699 2715 return 2700 2716 endif … … 2840 2856 2841 2857 ; --------------------------------------------------------------------------- 2842 ; For compatibilty 2858 ; For compatibilty. 2843 2859 defproc Get_File_Date( Filename) 2844 2860 return GetFileDateHex( Filename)
Note:
See TracChangeset
for help on using the changeset viewer.