Permalink
Browse files

intf: Windows: manage Universal Naming Convention paths

When a network drive is not mapped to a drive letter on Windows,
the path will appear as an UNC path starting with 'file://'.
However, Lua will fail to open that file to resolve the hash.
This thus fixes that problem by changing the protocol from 'file'
to 'unc' in order to avoid trying to resolve the hash when
reading a media from an UNC path.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
  • Loading branch information...
XaF committed Jun 14, 2018
1 parent 4cbec8c commit 9b9d57c020e84ac3faf8c2918878e75d57e96258
Showing with 13 additions and 3 deletions.
  1. +13 −3 trakt.lua
@@ -1905,10 +1905,20 @@ function get_current_info()
uri_proto = 'file'
uri_path = infos['uri']
elseif uri_proto == 'file' and
uri_path:sub(1,1) == '/' and
ospath.sep == '\\' then
-- On Windows, remove leading slash for file URIs
uri_path = uri_path:sub(2)
if uri_path:sub(1,1) == '/' then
-- On Windows, remove leading slash for file URIs
uri_path = uri_path:sub(2)
elseif string.match(uri_path, '^[a-zA-Z0-9][a-zA-Z0-9]+/') then
-- If the resolved path is an UNC path (starting by the
-- network drive name), change the uri_proto to unc to
-- specify that we will not try and resolve the media hash
vlc.msg.info('Media path is in the form of the Universal ' ..
'Naming Convention; Map the drive to a drive ' ..
'letter in order for the media hashes to be ' ..
'resolved.')
uri_proto = 'unc'
end
end
cache[infos['key']].uri_proto = uri_proto

0 comments on commit 9b9d57c

Please sign in to comment.