Prevent automatically downloading files from OneDrive on-demand
In reference to this issue: #227 (closed)
The default libraries on Windows 10 include OneDrive. On new installs from the Fall Creators update on, users can enable "Files On Demand", which lets the user and other programs see the files in Explorer and programmatically, but only download them when needed. In the case of VLC, this is problematic. Currently, when indexing, we try and get its metadata... which means for OneDrive files, we always download them. This can lead to unexpected behavior, since the user may not want all of their music downloaded on the device, like a Laptop.
Currently, if a user doesn't want VLC to download their files from OneDrive, they have to block it in the Windows 10 settings, which is not ideal. There are APIs for seeing if a file is "available" on the system (https://docs.microsoft.com/en-us/windows/uwp/files/quickstart-determining-availability-of-microsoft-onedrive-files) but these are also not ideal for us, since they assume of a user is online, they can download the file, so it's always "available".
What we can do is check the attributes of the file, and if it has one that could indicate that it's not actually on the system, we'll skip it from being indexed. If a user did want it indexed, they can go to OneDrive and request it to be downloaded. That seems fairer than just downloading everything.
In this case, if a file has the Attribute SparseFile
, it's not actually on the system. So if we check a file and it does have that attribute, it shouldn't be touched.
Merge request reports
Activity
added 1 commit
- 68a15031 - Check if file is on disk before getting its properties
Currently, when indexing, we try and get its metadata... which means for OneDrive files, we always download them.
I could not reproduce this behavior. I do have "Files On Demand" enabled and can see a "OneDrive" directory in File Explorer, albeit outside of Videos/Music. But the indexing never get to it it seems so I can't really test this.
The default libraries on Windows 10 include OneDrive.
You're probably right, but I don't see it documented here: https://docs.microsoft.com/en-us/windows/uwp/files/quickstart-managing-folders-in-the-music-pictures-and-videos-libraries
In this case, if a file has the Attribute
SparseFile
, it's not actually on the system. So if we check a file and it does have that attribute, it shouldn't be touched.I'm fine with this and don't really have a better solution.
However, the documentation states
Sparse files are typically large files whose data consists of mostly zeros.
Can you think of other special kinds of files (like OneDrive's) that could have this flag yet that we'd like to index? I can't.
mentioned in commit fbc38cb1
mentioned in issue #227 (closed)