Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder Class ".create()" Example 2 Incorrect. #340

Open
Angel-Vazquez opened this issue May 15, 2024 · 0 comments
Open

Folder Class ".create()" Example 2 Incorrect. #340

Angel-Vazquez opened this issue May 15, 2024 · 0 comments

Comments

@Angel-Vazquez
Copy link

When invoking .create(), the boolean return false if the folder already exists.
image

Therefore, example 2 is incorrect and should be re-written to ensure the status of function .exists before the "Impossible" alert gets called.

Proposed Change

$newFolder:=Folder("/PACKAGE/Archives2019/January")
$wasCreated:=$newFolder.create()

Case of

 : ($wasCreated)
     ALERT("The "+$newFolder.name+" folder was created.")

 : ($newFolder.exists)
     ALERT("The "+$newFolder.name+" folder was previously created.")

Else
     ALERT("Impossible to create a "+$newFolder.name+" folder.")

End case

Existing Example Code

$newFolder:=Folder("/PACKAGE/Archives2019/January")
If($newFolder.create())
 ALERT("The "+$newFolder.name+" folder was created.")
Else
 ALERT("Impossible to create a "+$newFolder.name+" folder.")
End if

https://github.com/4d/docs/blob/main/docs/API/FolderClass.md#create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant