diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-07 15:08:32 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-09-07 15:08:32 -0400 |
| commit | 24d221709dec35456dc2702d5ddb7cfa204bd8bd (patch) | |
| tree | 5fbad020efc1bc2154812128a32fd88afa50ffb3 /MediaBrowser.Controller/IO/FileData.cs | |
| parent | 90c609c159d7746352fa3481550b44fcd5090f6d (diff) | |
Fixed an issue with shortcuts pointing to a network share
Diffstat (limited to 'MediaBrowser.Controller/IO/FileData.cs')
| -rw-r--r-- | MediaBrowser.Controller/IO/FileData.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 75069d4d5..f5375e71b 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -1,4 +1,5 @@ -using System;
+using MediaBrowser.Common.Logging;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
@@ -12,6 +13,7 @@ namespace MediaBrowser.Controller.IO {
public const int MAX_PATH = 260;
public const int MAX_ALTERNATE = 14;
+ public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
/// <summary>
/// Gets information about a path
@@ -20,8 +22,21 @@ namespace MediaBrowser.Controller.IO {
WIN32_FIND_DATA data;
IntPtr handle = FindFirstFile(path, out data);
+
+ if (handle == INVALID_HANDLE_VALUE && !Path.HasExtension(path))
+ {
+ Logger.LogInfo("Handle came back invalid for {0}. Since this is a directory we'll try appending \\*.", path);
+
+ FindClose(handle);
+
+ handle = FindFirstFile(Path.Combine(path, "*"), out data);
+ }
+
if (handle == IntPtr.Zero)
+ {
throw new IOException("FindFirstFile failed");
+ }
+
FindClose(handle);
data.Path = path;
|
