Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string ExecutingAssemblyPath()
- {
- Assembly actualAssembly = Assembly.GetEntryAssembly();
- if (this.actualAssembly == null)
- {
- actualAssembly = Assembly.GetCallingAssembly();
- }
- return actualAssembly.Location;
- }
- string absolutePath = Settings.Default.ImagePath;
- if(!Path.IsPathRooted(absolutePath))
- {
- string root = Assembly.GetEntryAssembly().Location;
- root = Path.GetDirectoryName(root);
- absolutePath = Path.Combine(root, absolutePath);
- }
- new System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile).Directory;
- Application.StartupPath
- public static string RealAssemblyFilePath()
- {
- string dllPath=Assembly.GetExecutingAssembly().CodeBase.Substring(8);
- return dllPath;
- }
- public static IEnumerable<DirectoryInfo> ParentDirs(this DirectoryInfo dir) {
- while (dir != null) {
- yield return dir;
- dir = dir.Parent;
- }
- }
- public static DirectoryInfo FindDataDir(string relpath, Assembly assembly) {
- return new FileInfo((assembly).Location)
- .Directory.ParentDirs()
- .Select(dir => Path.Combine(dir.FullName + @"", relpath))
- .Where(Directory.Exists)
- .Select(path => new DirectoryInfo(path))
- .FirstOrDefault();
- }
Add Comment
Please, Sign In to add comment