Details
-
Task
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.6.0
-
None
-
WinRT, Windows Phone, Windows 10, Win10IoTCore
Description
The problem:
Right now we use the win32 API for file access, which some (if not many) modifications to work properly on WinRT.
The auto tests are fully functional right now.
However, with the Win32 API one is not able to access any file outside the sandbox. You have to use IStorage* WinRT
classes for that. This requires to reimplement the fileengine inside Qt Core.
Approach:
There is already a file engine in the platform plugin which we use for file dialog handling. A native file dialog
always returns a IStorage*.
However, we need to have a consistent approach for filepaths. We could come up with alternative approaches
(eg [Pictures]/foo.jpg or /Pictures/foo.jpg or Pictures://foo.jpg)). Doing this would cause incompatibilities with existing
applications and cause problems for users upgrading in case they stored absolute paths in settings or such.
Hence try to keep the user facing paths consistent (C:/Users/foo/...) and internally switch to the WinRT API when actually
doing work.
Details:
Conversion old -> new:
File: C:\foo\... -> IStorageFileStatics::GetFileFromPathAsync()
Folder: C:\foo -> IStorageFolderStatics::GetFolderFromPathAsync()
Conversion new -> old:
Folder:
inline QString pathForStorageFolder(const ComPtr<IStorageFolder> &folder)
File: Probably same via StorageItem conversion
QFileSystemEngine:
- use the one from platform plugin
QStandardPaths:
- Not possible to get eg. StandardLocation::MoviesLocation as this is IStorageFolder, which then again can hold
multiple directories. (C:\Users\foo\Movies and C:\OneDrive\Movies). Current approach is to iterate subfolders,
get their path (as in above new->old) and take the directory up.
QFileSystemIterator:
- Folders IStorageFolder::GetFoldersAsyncOverloadDefaultOptionsStartAndCount()
- Files IStorageFolder::GetFilesAsyncOverloadDefaultOptionsStartAndCount()
- Maybe just IStorageFolder::GetItemsAsyncOverloadDefaultStartAndCount() and have each item check for its type via .As()
Use Cases:
- Create file in current directory
- Query current directory and receive IStorageFolder
- Use IStorageFolder::createFileAsync()
- Create file with absolute path
- Split path into segments
- Check for longest "known" IStorageFolder X. Create hashmap during runtime
- From X iterate to subdirectories and create file
- Create folder
- Similar to file, but create folder in the end IStorageFolder::CreateFolderAsync()
Attachments
Issue Links
- is required for
-
QTBUG-50612 QFile::Copy fails on WinRT/Windows Phone because the file always exists before copying
-
- Closed
-
-
QTBUG-44436 [Windows Phone] Be able to access the SD Card for saving files to
-
- Closed
-
- relates to
-
QTBUG-49742 WinRT: QStandardPaths::writableLocation() returns empty strings for some enumeration values
-
- Closed
-
-
QTBUG-49299 Add support for StorageItemAccessList for accessing files outside of WinRT sandbox
-
- Closed
-