Skip to content

Prevent automatically downloading files from OneDrive on-demand

Tim Miller requested to merge OnedriveOnDemand into master

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