+ Reply to Thread
Results 1 to 5 of 5

Thread: Create Folder and error codes

  1. #1

    Default Create Folder and error codes

    I want to check for an error code when I create a folder. I have been creating the folders with no problem, but thought it would wise to check for an error just in case.

    I get an error code of 0 in my test installer made with SB72 after the create folder function. The folder already exists.

    The help file says:

    If the function succeeds, the %_SB_ERRORCODE% return value is nonzero.

    If the function fails, the return value is zero.

    Remarks

    The Create Folder function can be used to create multiple nested directories at the same time.

    An error occurs if the specified folder already exists.

    Which one is it really? Maybe I do not need to check for an error when creating a folder in the CSIDL_COMMON_DOCUMENTS location. Or check for the creation of a share or grant access.


    Jim

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Create Folder and error codes

    Jim,

    The "Create Folder" function returns "1" in %_SB_ERRORCODE% if the function succeeds (folder was created).

    It returns "0" if the folder creation failed (e.g. if the folder already existed).

    "An error occurs if the specified folder already exists" means the function returns "0" (= error) in %_SB_ERRORCODE%.

    BTW, "Create Folder" is a wrapper around the CreateDirectoryA Windows API.

    http://msdn.microsoft.com/en-us/libr...55(VS.85).aspx

    Does this help?

    Friedrich

  3. #3

    Default Re: Create Folder and error codes

    Yes. It makes since now.

    Will we ever get an error if it just cannot create it, not because it already exists so it did not create it?

  4. #4

    Default Re: Create Folder and error codes

    Yes that was helpful.

    Is there a specific error returned for it cannot create the folder?

    Jimmy

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Create Folder and error codes

    Jimmy,

    No, there are only two possible return values:

    1.) If the function succeeds, the return value is nonzero.
    2.) If the function fails, the return value is zero.

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •