こんにちは、初めてスタックオーバーフローを使用します。私が何か間違ったことをした場合は、事前にお詫び申し上げます。以下のコードは、Windows ではパスを返すことに関して完全に機能しますが、Ubuntu では mono 2.10.8.1 を使用します。
パスは/home/procon/Plugins/BF3/filename.cfg
代わりに、ファイルを探しています/home/procon/home/procon/Plugins/BF3/filename.cfg
問題を以下のコードに絞り込み、Application.ExecutablePath を Environment.CurrentDirectory に変更しようとしましたが、それでも間違ったパスが返されます。何か案は?
public static String makeRelativePath(String file)
{
String exe_path = Directory.GetParent(Application.ExecutablePath).FullName;
String dll_path = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
String rel_path = dll_path.Replace(exe_path, "");
rel_path = Path.Combine(rel_path.Trim(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }), file);
return rel_path;
}