diff --git a/Snap2HTML/Models.cs b/Snap2HTML/Models.cs
index d514e04..7febb8c 100644
--- a/Snap2HTML/Models.cs
+++ b/Snap2HTML/Models.cs
@@ -65,7 +65,23 @@ namespace Snap2HTML
public string GetFullPath()
{
- return ( this.Path + "\\" + this.Name ).Replace( "\\\\", "\\" );
+ string path;
+
+ if( this.Path.EndsWith( @"\" ) )
+ path = this.Path + this.Name;
+ else
+ path = this.Path + @"\" + this.Name;
+
+ if( path.EndsWith( @"\" ) ) // remove trailing backslash
+ {
+ if(!Utils.IsWildcardMatch( @"?:\", path, false )) // except for drive letters
+ {
+ path = path.Remove( path.Length - 1 );
+ }
+
+ }
+
+ return path;
}
public string GetProp( string key )
diff --git a/Snap2HTML/frmMain.cs b/Snap2HTML/frmMain.cs
index 2128e04..161e740 100644
--- a/Snap2HTML/frmMain.cs
+++ b/Snap2HTML/frmMain.cs
@@ -211,14 +211,21 @@ namespace Snap2HTML
// add slash or backslash to end of link (in cases where it is clear that we we can)
if( settings.linkFiles )
{
- if( !settings.linkRoot.EndsWith( @"/" ) && settings.linkRoot.ToLower().StartsWith( @"http" ) ) // web site
+ if( !settings.linkRoot.EndsWith( @"/" ) )
+ {
+ if( settings.linkRoot.ToLower().StartsWith( @"http" ) ) // web site
{
settings.linkRoot += @"/";
}
- if( !settings.linkRoot.EndsWith( @"\" ) && Utils.IsWildcardMatch( "?:*", settings.linkRoot, false ) ) // local disk
+ if( Utils.IsWildcardMatch( "?:*", settings.linkRoot, false ) ) // local disk
{
settings.linkRoot += @"\";
}
+ if( settings.linkRoot.StartsWith( @"\\" ) ) // unc path
+ {
+ settings.linkRoot += @"\";
+ }
+ }
}
Cursor.Current = Cursors.WaitCursor;
diff --git a/Snap2HTML/frmMain_BackgroundWorker.cs b/Snap2HTML/frmMain_BackgroundWorker.cs
index 5095867..0571e38 100644
--- a/Snap2HTML/frmMain_BackgroundWorker.cs
+++ b/Snap2HTML/frmMain_BackgroundWorker.cs
@@ -86,10 +86,15 @@ namespace Snap2HTML
{
sbTemplate.Replace( "[LINK PROTOCOL]", @"file://" );
}
+ else if( link_root.StartsWith( "//" ) ) // for UNC paths e.g. \\server\path
+ {
+ sbTemplate.Replace( "[LINK PROTOCOL]", @"file://///" );
+ }
else
{
sbTemplate.Replace( "[LINK PROTOCOL]", "" );
}
+
}
else
{
@@ -355,10 +360,12 @@ namespace Snap2HTML
var subdirs = new Dictionary>();
foreach( var dir in content )
{
+ // add all folders as keys
subdirs.Add( dir.GetFullPath(), new List() );
}
if( !subdirs.ContainsKey( content[0].Path ) && content[0].Name != "" )
{
+ // ensure that root folder is not missed missed
subdirs.Add( content[0].Path, new List() );
}
foreach( var dir in content )
@@ -367,6 +374,7 @@ namespace Snap2HTML
{
try
{
+ // for each folder, add its index to its parent folder list of subdirs
subdirs[dir.Path].Add( dirIndexes[dir.GetFullPath()] );
}
catch( Exception ex )
@@ -397,7 +405,7 @@ namespace Snap2HTML
result.Append( "" ).Append( dirSize ).Append( "," + lineBreakSymbol );
// Add reference to subdirs
- result.Append( "\"" ).Append( String.Join( "*", subdirs[currentDir.GetFullPath()].ToArray() ) ).Append( "\"" + lineBreakSymbol ); // subdirs
+ result.Append( "\"" ).Append( String.Join( "*", subdirs[currentDir.GetFullPath()].ToArray() ) ).Append( "\"" + lineBreakSymbol );
// Finalize
result.Append( "])" );