Elight.Utility/Extension/MyEnvironment.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Elight.Utility.Extension
{
public class MyEnvironment
{
public static string WebRootPath(string path)
{
return RootPath("/wwwroot"+path);
}
public static string RootPath(string path)
{
string basePath = "";
#if NETFRAMEWORK
basePath = AppDomain.CurrentDomain.BaseDirectory.Replace("/", "\\");
if (!basePath.EndsWith("\\"))
{
basePath += "\\";
}
path = path.Replace("/", "\\");
if (path.StartsWith("\\"))
{
path = path.Substring(1, path.Length - 1);
}
return basePath + path;
#else
if (OperatingSystem.IsWindows())
{
basePath = AppDomain.CurrentDomain.BaseDirectory.Replace("/", "\\");
if (!basePath.EndsWith("\\"))
{
basePath += "\\";
}
path = path.Replace("/", "\\");
if (path.StartsWith("\\"))
{
path = path.Substring(1, path.Length - 1);
}
return basePath + path;
}
else
{
basePath = AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/");
if (!basePath.EndsWith("/"))
{
basePath += "/";
}
path = path.Replace("\\", "/");
if (path.StartsWith("/"))
{
path = path.Substring(1, path.Length - 1);
}
return basePath + path;
}
#endif
后面还有 4 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。