public static string GetConfigPath(string filename) { string path = CFileUtils.ChangeExtension(filename, ".cfg"); if (CFileUtils.IsPathRooted(path)) { return(path); } return(Path.Combine(ConfigPath, path)); }
public void TestFileReplaceExt() { string path = "autoexec.cfg"; Assert.AreEqual("autoexec.cfg", CFileUtils.ChangeExtension(path, ".cfg")); path = "usr/bin/autoexec.cfg"; Assert.AreEqual("usr/bin/autoexec.cfg", CFileUtils.ChangeExtension(path, ".cfg")); path = "usr/bin/autoexec.CFG"; Assert.AreEqual("usr/bin/autoexec.cfg", CFileUtils.ChangeExtension(path, ".cfg")); path = "usr/bin/autoexec"; Assert.AreEqual("usr/bin/autoexec.cfg", CFileUtils.ChangeExtension(path, ".cfg")); }