DataFolderExists for data folder references

Replacement for DataFolderExists(string) using datafolder references
/// Checks if the datafolder referenced by dfr exists.
/// Unlike DataFolderExists() a dfref pointing to an empty ("") dataFolder is considered non-existing here.
/// @returns one if dfr is valid and references an existing datafolder, zero otherwise
Function DataFolderExistsDFR(dfr)
    dfref dfr

    string dataFolder

    switch(DataFolderRefStatus(dfr))
        case 0: // invalid ref, does not exist
            return 0
        case 1: // might be valid
            dataFolder = GetDataFolder(1,dfr)
            return cmpstr(dataFolder,"") != 0 && DataFolderExists(dataFolder)
        case 3: // free data folders always exist
            return 1
        default:
            Abort "unknown status"
            return 0
    endswitch
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More