• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 67
  • Last Modified:

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?
0
VSmolensky
Asked:
VSmolensky
  • 2
  • 2
1 Solution
 
Sinisa VukCommented:
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
 
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 VukCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now