1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? if isdir ....

Discussion in 'Support' started by fpefpe, Dec 7, 2012.

  1. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Hello -- Does anyone know which win api function that this conditional uses in tcc? Thanks
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    Appears to be Kernel32.dll, GetFileAttributesW(). And FILE_ATTRIBUTE_DIRECTORY is 16 (0x10).

    There also exists Shlwapi.dll (BOOL) PathIsDirectory (W and A versions).
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    You could get misleading results if you specify the name of something that doesn't exist. GetFileAttributesW will return -1 (0xFFFFFFFF). If you test that result like this
    Code:
    if %@eval[%@winapi[...] AND 16] == 16, it will be true.
     
  4. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Hello –

    Thanks for the info –

    I been using sugarsync and just updated to V2 ... I have app that using that call (GetFileAttributes) too, but when I test to see if the item specified is a dir in the new SS drive, it fails where the tcc “if isdir” works –

    there is info in the doc for the win api func to test for 0xffff – which means the item does not exist

    call you post the text to the winapi call – thx
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
  6. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1

Share This Page