C# 在linux 服务器上如何获得相对路径
在 Linux 服务器上,可以使用以下代码获取当前工作目录的相对路径:
string currentDirectory = System.IO.Directory.GetCurrentDirectory();
string relativePath = currentDirectory.Substring(AppDomain.CurrentDomain.BaseDirectory.Length);
这将获取当前工作目录的绝对路径,并通过删除应用程序域的基目录来获得相对路径。
原文地址: https://www.cveoy.top/t/topic/iMkd 著作权归作者所有。请勿转载和采集!