Skip to content

Commit

Permalink
改善Linux兼容性,解决路径多次追加问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JaymzZh committed Apr 1, 2016
1 parent 8f0728a commit 8faa91a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions NewLife.Core/IO/PathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ private static String GetPath(String path, Int32 mode)
// 为了兼容Linux,再次判断,可能已经是跟路径
if (!NewLife.Runtime.Mono || !path.StartsWith(dir))
{
path = path.TrimStart(sep);
path = Path.Combine(dir, path);
// path目录存在,不用再次拼接
if (!Directory.Exists(path))
{
path = path.TrimStart(sep);
path = Path.Combine(dir, path);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions NewLife.Core/Log/TextFileLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public String LogPath
get
{
if (String.IsNullOrEmpty(_LogPath) && !String.IsNullOrEmpty(LogFile))
_LogPath = Path.GetDirectoryName(LogFile).GetFullPath().EnsureEnd(@"\");
_LogPath = Path.GetDirectoryName(LogFile).GetFullPath().EnsureEnd(Path.DirectorySeparatorChar.ToString());
return _LogPath;
}
set
{
if (String.IsNullOrEmpty(value))
_LogPath = value;
else
_LogPath = value.GetFullPath().EnsureEnd(@"\");
_LogPath = value.GetFullPath().EnsureEnd(Path.DirectorySeparatorChar.ToString());
}
}

Expand Down
2 changes: 1 addition & 1 deletion NewLife.Cube/NewLife.Cube.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0</VSToolsPath>
<!-- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0</VSToolsPath>-->
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Cube/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NewLife.Cube
{
/// <summary>魔方设置</summary>
[DisplayName("魔方设置")]
[XmlConfigFile(@"Config\\Cube.config", 15000)]
[XmlConfigFile(@"Config\Cube.config", 15000)]
public class Setting : XmlConfig<Setting>
{
#region 属性
Expand Down

0 comments on commit 8faa91a

Please sign in to comment.