Why do folders created in UWP apps seem non-existent?

My Delphi application for Windows is packed in appx so I can have it published in Microsoft Store. At the first run, the app creates a folder in <user>AppData\Roaming to store there some files accessible for the users. Here's the code:

MyFolder:=GetSpecialFolderPath(CSIDL_APPDATA)+'\MyApp';
CreateDir(MyFolder);
TDirectory.SetAttributes(MyFolder,[TFileAttribute.faNormal]);

Open in new window


It works fine. When the app is running, the users can open its dialog windows, see this folder with all the files, read them or write into them. But only from the app! The mystery is that this new folder cannot be seen in Windows Explorer. Even in Command Prompt it seems non-existent!

Can anybody explain what this means?
VSmolenskyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
This is because main folder: <user>AppData\Roaming is hidden - so your too then.
You can use current user Document folder - which is available.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VSmolenskyAuthor Commented:
No, it's not. The folder <user>AppData\Roaming is NOT hidden. I can easily see it in Windows Explorer with all its subfolders, except MyApp.
0
Sinisa VukSoftware architectCommented:
Do you have show hidden files and folders enabled in win explorer?
try to create folder with: ForceDirectories(MyFolder)
...and even more ... show message with path before creating folder before creating... then you be sure where it is...

MyFolder:=GetSpecialFolderPath(CSIDL_APPDATA)+'\MyApp';
ShowMessage(MyFolder);
ForceDirectories(MyFolder);
...

Open in new window

0
VSmolenskyAuthor Commented:
ForceDirectories in my case works just like CreateDir. No difference.

But you are absolutely right about the hidden nature of AppData! It looks like even when it's not hidden in my Windows Explorer, it still works in a very special way with its subfolders. I've just replaced CSIDL_APPDATA by CSIDL_COMMON_APPDATA, and everything is fine now! All the files go to C:\ProgramData\MyApp and I can easily see them from any place.

Thank you very much for the right direction of thinking!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.