/// <summary> /// Returns true if this file exists /// </summary> /// <param name="filepath"></param> /// <returns></returns> public static bool Exists(string filepath) { string clean = PathTools.CleanPath(filepath); string p = SanitizeFilename(clean); return(_assemblyFiles.ContainsKey(p)); }
/// <summary> /// Returns true if the path is valid relative to the current path(the current script that is processed /// </summary> /// <param name="currentPath">the current path of the program</param> /// <param name="file">the relative file path</param> /// <returns>true if the relative path is pointing towards a valid file.</returns> public static bool FileExistsRelativeTo(string currentPath, string file) { string s = PathTools.CleanPath(Path.Combine(currentPath, file)); bool ret1 = IOManager.FileExists(s /*Path.Combine(currentPath, file)*/); return(ret1); }
/// <summary> /// Returns true if the path is valid relative to the current path(the current script that is processed /// </summary> /// <param name="currentPath">the current path of the program</param> /// <param name="file">the relative file path</param> /// <returns>true if the relative path is pointing towards a valid file.</returns> public static bool FileExistsRelativeTo(string currentPath, string file) { string combined = Path.Combine(currentPath, file.Replace('/', '\\')); string s = PathTools.CleanPath(combined); bool ret1 = File.Exists(s /*Path.Combine(currentPath, file)*/); return(ret1); }
/// <summary> /// Turns a Filepath that refers to an file on the filesystem into a filepath for assembly files /// </summary> /// <param name="filepath"></param> /// <returns></returns> public static string SanitizeFilename(string filepath) { if (filepath[0] == '/' || filepath[0] == '\\') { filepath = filepath.Remove(0, 1); } if (filepath[filepath.Length - 1] == '/' || filepath[filepath.Length - 1] == '\\') { filepath = filepath.Remove(filepath.Length - 1, 1); } string clean = PathTools.CleanPath(filepath); return(clean.Replace("/", ".").Replace("\\", ".")); }