Create folder in temporary folder

Is it possible/permitted to create subfolders in the /tmp folder on Xojo Cloud server?

Use SpecialFolder.Temporary.

Sorry, I didn’t put enough detail in my message. What I am doing is using the GetTemporaryFolderItem and then parsing out the part of the returned file that looks like rbtA43B to create a folder. I am doing it this way because my app creates a bunch of separate files and at the end I just want to delete them all. It is “easier” to delete a folder than all the separate files.

If I can’t create the folder I will come up with another method. Maybe I will try to save all the information in one tmp file (e.g., everything goes into rbtA43B.tmp) or just reuse the rbtA43B multiple times (e.g., rbtA43B_file1,tmp, rbtA43B_file2.tmp, etc).

It’s not really easier. You can’t delete the folder without deleting its contents.

Keeping that in mind, SpecialFolder.Temporary is only your temp files, so there will never be conflicts unless you create them.

Well, I can delete entire folder with files on PC. I guess Linux is different.

I will just use option 2 (append something to filename provided by GetTemporaryFolderItem).

By the way, what are the temp filenames based on?

We get those from the operating system.

Thanks for your help Greg.

Followup: I want to add something to the filename created by GetTemporaryFolderItem so I don’t have to keep track of all the different temporary filenames. I wanted to do something like this: MyApp_rbx345_MyData1.tmp, MyApp_rbx345_MyData2.tmp, etc for each file created by the app. I don’t think this is allowed on the Xojo Cloud server (it works fine on the localhost Windows PC). If I just use the filename as is from GetTemporaryFolderItem (in this example, rbx345.tmp which is created in tmp folder) it works.

Is it possible to use custom filenames in the tmp folder on the Xojo Cloud server?

Error I get when using my custom filename is here:

Unhandled IOException
Message:

Stack:
TextOutputStream.!Create%o%o
InstructionPage.InstructionPage.CheckID%%o<InstructionPage.InstructionPage>
InstructionPage.InstructionPage.GoToLogin2_Action%%o<InstructionPage.InstructionPage>o
Delegate.IM_Invoke%%o
AddHandler.Stub.28%%
WebButton._ExecuteEvent%b%osA1v
WebControl.!_ExecuteEvent%b%ssA1v
WebSession._HandleEvent%%oso<HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<HTTPServer.HTTPRequestContext>
WebApplication.HandleHTTPRequest%%oo<HTTPServer.HTTPRequestContext>
_CGIGateway.GatewayRequestThread.Event_Run%%o<_CGIGateway.GatewayRequestThread>

There are actually two temporary folders on Xojo cloud. There is the system temp folder (where GetTemporaryFile points) and SpecialFolder.Temporary which is fully readable/writable by your apps. If you use the latter, you can use any name you want. The former is restricted by SELinux rules to only allow the names given to you.

Here is the path I am trying to save to which is produced by using SpecialFolder.Temporary:

/home/sites/www.example.com/tmp/

Here is the path produced by GetTemporaryFolderItem:

/tmp/

I don’t know which path to use but I tried the custom filename to /home/sites/www.example.com/tmp/ and got the error so I assume the path produced by GetTemporaryFolderItem is the correct one; unfortunately, I am at a loss as to how to use that path in a way that isn’t OS-specific. Any pointers?

Ok. I used GetTemporaryFolderItem.parent (/tmp/ on the server). It seems to have worked (no errors at least)! Thanks for pointing me in the right direction (again).

This is good to know. Perhaps it should be added to the Xojo documentation.