X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 15 Apr 2015 11:32 AM by  Zachary Norman
FILE_TEST function behavior
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Zachary Norman



Basic Member


Posts:173
Basic Member


--
15 Apr 2015 11:32 AM
    I found that function File_Test(file, /DIRECTORY) changes the modification date/time of the folder being tested in IDL 8.2. If I understand correctly, this function (with DIR keyword) is supposed to just tell me if the file is a directory, not to do anything to that file. But now every time I test a folder, its original modification time is changed by IDL to the current time. I didn't see this issue in IDL 7.1. Is it a new bug in 8.2 or is there any keyword or workaround that can keep this from happening? Thank you.

    Zachary Norman



    Basic Member


    Posts:173
    Basic Member


    --
    15 Apr 2015 11:33 AM
    Hello, This behavior is a bug that has been filed. However, here is a workaround: ; Example program that uses the Windows DIR command ; to determine if target path is a directory or not. FUNCTION dirtest, path SPAWN, 'DIR /B /A:D "'+path+'"', out, err RETURN, (WHERE(err EQ 'File Not Found'))[0] EQ -1 ? 1 : 0 END ;;;;;;;;;;;;;;;;;; ; Test call target1 = FILEPATH('dist.pro', SUBDIRECTORY=['lib']) target2 = FILEPATH('lib') HELP, target1 PRINT, dirtest(target1) ? 'Target is a directory.' : 'Target is not a directory.' HELP, target2 PRINT, dirtest(target2) ? 'Target is a directory.' : 'Target is not a directory.' END
    You are not authorized to post a reply.