Skip to main content
Known Participant
January 6, 2016
Answered

Writing in app-storage directory inside Worker

  • January 6, 2016
  • 1 reply
  • 1021 views

Hi there,

In my Adobe AIR app (desktop), I wrote a FileDownloader class that use insternally a FileStream instance to write remote files into the application storage directory

The problem is that the UI freezes during the download process (even though i opened the local file asynchronously)

As a workaround, I thought it could be a good idea to use a Worker to download those files, but when I try to write them inside the app-storage directory from my Worker thread,

the Worker writes it in this folder : %appdata%\[Worker].null\Local Store

As you can see, the app-storage directory is inside this folder named "[Worker].null"  instead of being in my real app-storage dir (named by my app identifier)

A solution I found is to write the downloaded files to a tmp file, and then, in the main Worker Thread, use moveToAsync to move the file to my app-storage directory, but it's not very clean... and moveToAsync takes time with large files...

Anyone has experienced this issue?

Is it the normal behavior or is it a bug? I think the Worker should have the same app-storage directory as the application that embed it (especially when you set giveAppPrivileges=true in createWorker method)

Thanks

(and sorry for my english)

This topic has been closed for replies.
Correct answer leop66344762

Hi,

Having worked with multiple Workers on my own project, I have experienced the very same behaviour.

The solution I found was to set a shared property on the worker, with the native path of the app.

So, on the primordial worker, you get the applicationStorageDirectory native path, and then set the shared property on the worker.

hope it helps.

regards,

Leo

1 reply

leop66344762
leop66344762Correct answer
Inspiring
January 20, 2016

Hi,

Having worked with multiple Workers on my own project, I have experienced the very same behaviour.

The solution I found was to set a shared property on the worker, with the native path of the app.

So, on the primordial worker, you get the applicationStorageDirectory native path, and then set the shared property on the worker.

hope it helps.

regards,

Leo

PhendraxAuthor
Known Participant
January 21, 2016

Awesome, I didn't think about that

Thanks a lot

leop66344762
Inspiring
January 21, 2016

But I do agree with you, that all workers should share the same keyword based folders.

In the end: applicationStorageDirectory refers to the Application, and your Worker is part of the Application.

To me, all Workers should point to the same path if using such "magic paths".

chris.campbell - perhaps you could check it?