Skip to content

Commit 0a76f2d

Browse files
author
Marc Sallin
committed
#89 replaced '\\' with Path.DirectorySeparatorChar to support mono.
1 parent 65d613d commit 0a76f2d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

SQLite.CodeFirst/Internal/Utility/ConnectionStringParser.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Diagnostics.CodeAnalysis;
44
using System.Globalization;
5+
using System.IO;
56

67
namespace SQLite.CodeFirst.Utility
78
{
@@ -64,14 +65,14 @@ private static string ExpandDataDirectory(string path)
6465

6566
// We don't know if rootFolderpath ends with '\', and we don't know if the given name starts with onw
6667
int fileNamePosition = DataDirectoryToken.Length; // filename starts right after the '|datadirectory|' keyword
67-
bool rootFolderEndsWith = (0 < rootFolderPath.Length) && rootFolderPath[rootFolderPath.Length - 1] == '\\';
68-
bool fileNameStartsWith = (fileNamePosition < path.Length) && path[fileNamePosition] == '\\';
68+
bool rootFolderEndsWith = (0 < rootFolderPath.Length) && rootFolderPath[rootFolderPath.Length - 1] == Path.DirectorySeparatorChar;
69+
bool fileNameStartsWith = (fileNamePosition < path.Length) && path[fileNamePosition] == Path.DirectorySeparatorChar;
6970

7071
// replace |datadirectory| with root folder path
7172
if (!rootFolderEndsWith && !fileNameStartsWith)
7273
{
7374
// need to insert '\'
74-
fullPath = rootFolderPath + '\\' + path.Substring(fileNamePosition);
75+
fullPath = rootFolderPath + Path.DirectorySeparatorChar + path.Substring(fileNamePosition);
7576
}
7677
else if (rootFolderEndsWith && fileNameStartsWith)
7778
{

0 commit comments

Comments
 (0)