Is CreateAsFolder supposed to silently delete an existing folder?

  1. 8 months ago

    Jeff T

    12 Feb 2019 Pre-Release Testers Midlands of England, Europe

    As the title says.. I have unzip code that is based on some example from MBS, which does a CreateAsFolder if the zipped item is a folder

    Untouched for a long time, I am getting reports from some people that it actually throws away an existing folder which contains data.
    I was under the impression that to delete a folder, we had to recursively delete the contents, but that doesnt seem to be the case.
    The documentation is silent on this

    Xojo 2017

  2. Derk J

    12 Feb 2019 Pre-Release Testers, Xojo Pro

    Why not check folderitem.exists before creating?

  3. Jeff T

    12 Feb 2019 Pre-Release Testers Midlands of England, Europe

    Why not check folderitem.exists before creating?

    I do now.
    I havent needed to for a long time.
    And didnt think I needed to, for the reasons above.

    I want to know what the expected behaviour is, because a customer is angry with me, and I would like to know if I should be angry with myself or the docs.

  4. Paul L

    12 Feb 2019 Xojo Inc, Third Party Store http://docs.xojo.com

    I don't expect that behavior and in a quick test here with 2018r4 on Windows 10 and High Sierra I am not seeing that CreateFolder is removing an existing folder that has content in it.

  5. Jürg O

    12 Feb 2019 Pre-Release Testers, Xojo Pro

    Well, the expected behavior is that this either does nothing (since the folder already exists) or shows an error.
    A quick test on macOS 64Bit: folder (and it's content) remain. And theFolderItem.LastErrorCode = 105 (invalid name)

or Sign Up to reply!