当前位置: 首页>>代码示例>>C#>>正文


C# FilePath.ToEnvironmentalPath方法代码示例

本文整理汇总了C#中FilePath.ToEnvironmentalPath方法的典型用法代码示例。如果您正苦于以下问题:C# FilePath.ToEnvironmentalPath方法的具体用法?C# FilePath.ToEnvironmentalPath怎么用?C# FilePath.ToEnvironmentalPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilePath的用法示例。


在下文中一共展示了FilePath.ToEnvironmentalPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFirstMatch

        public FilePath GetFirstMatch(FilePath root, string pattern)
        {
            var first = Directory.EnumerateFiles(root.ToEnvironmentalPath(), pattern, SearchOption.TopDirectoryOnly)
                .FirstOrDefault();

            if (string.IsNullOrEmpty(first)) return null;

            return (FilePath)first;
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:9,代码来源:RealFileSystem.cs

示例2: DirectoryExists

 public bool DirectoryExists(FilePath p)
 {
     try
     {
         return Directory.Exists(p.ToEnvironmentalPath());
     }
     catch
     {
         return false;
     }
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:11,代码来源:RealFileSystem.cs

示例3: DeletePath

        public void DeletePath(FilePath path)
        {
            var epath = path.ToEnvironmentalPath();
            var gitPath = path.Navigate((FilePath)".git").ToEnvironmentalPath();

            if (Directory.Exists(gitPath)) Directory.Delete(gitPath, true);

            if (Directory.Exists(epath))
                Directory.Delete(epath, true);
            else
                File.Delete(epath);
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:12,代码来源:RealFileSystem.cs

示例4: CopyBuildResultsTo

        public void CopyBuildResultsTo(FilePath dest)
        {
            // For every file in dest, if we have a newer copy then overwrite dest file.
            // masters always override other available files
            if (!Directory.Exists(dest.ToEnvironmentalPath())) return;
            var files = Directory.GetFiles(dest.ToEnvironmentalPath(), _patterns.DependencyPattern, SearchOption.TopDirectoryOnly);
            foreach (var target in files)
            {
                var name = Path.GetFileName(target);
                if (name == null) continue;

                var source = _masters.Of(name) ?? _available.Of(name);

                if (source == null)
                {
                    Log.Verbose("No source for => " + target);
                    continue;
                }

                Log.Verbose(source.FullName + " => " + target);
                source.CopyTo(target, true);
            }
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:23,代码来源:DependencyManager.cs

示例5: SetByLatest

        static void SetByLatest(FilePath srcPath, IDictionary<string, FileInfo> repo, string pattern)
        {
            var files = Directory.GetFiles(srcPath.ToEnvironmentalPath(), pattern, SearchOption.AllDirectories);
            foreach (var file in files)
            {
                var name = Path.GetFileName(file);
                if (name == null) continue;
                var newInfo = new FileInfo(file);
                if (!repo.ContainsKey(name))
                {
                    repo.Add(name, newInfo);
                    continue;
                }

                var existing = repo[name];
                if (newInfo.LastWriteTime > existing.LastWriteTime)
                    repo[name] = newInfo;
            }
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:19,代码来源:DependencyManager.cs

示例6: CopyDirectory

        public void CopyDirectory(FilePath src, FilePath dst)
        {
            if (!DirectoryExists(src)) throw new Exception("Source was not a folder or doesn't exist");

            if (IsFile(dst)) throw new Exception("Destination already exists as a file");
            if (DirectoryExists(dst))
            {
                try
                {
                    DeletePath(dst);
                }
                catch
                {
                    throw new Exception("Tried to delete " + dst + " to replace it, but failed");
                }
            }

            DirectoryCopy(src.ToEnvironmentalPath(), dst.ToEnvironmentalPath(), true);
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:19,代码来源:RealFileSystem.cs

示例7: Should_throw_if_file_doesnt_have_an_extension

 public void Should_throw_if_file_doesnt_have_an_extension(string inputPath)
 {
     var filePath = new FilePath(inputPath);
     var ex = Assert.Throws<InvalidOperationException>(()=>filePath.Extension());
     Assert.That(ex.Message, Is.EqualTo(string.Format("{0} does not have an extension", filePath.ToEnvironmentalPath())));
 }
开发者ID:i-e-b,项目名称:LessStupidPath,代码行数:6,代码来源:ExtensionTests.cs

示例8: UpdateAvailableDependencies

 public void UpdateAvailableDependencies(FilePath srcPath)
 {
     if (!Directory.Exists(srcPath.ToEnvironmentalPath())) return;
     // for every pattern file under srcPath, add to list if it's the newest
     SetByLatest(srcPath, _available, _patterns.DependencyPattern);
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:6,代码来源:DependencyManager.cs

示例9: ReadModules

        void ReadModules(FilePath filePath)
        {
            Log.Verbose("Reading " + filePath.ToEnvironmentalPath());
            var lines = _files.Lines(filePath);

            var c = lines.Length;

            Repos = new string[c]; // src id => src repo
            Paths = new string[c]; // src id => file path
            Deps = new List<int>[c]; // src id => dst

            for (int i = 0; i < c; i++)
            {
                Log.Verbose(lines[i]);
                var bits = lines[i].Split('=').Select(s => s.Trim()).ToArray();

                Repos[i] = bits[1];
                Paths[i] = bits[0];
                Deps[i] = new List<int>();
            }
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:21,代码来源:Modules.cs

示例10: Lines

 public string[] Lines(FilePath path)
 {
     return
         File.ReadAllLines(path.ToEnvironmentalPath())
         .Where(l => !l.StartsWith("#") && !string.IsNullOrWhiteSpace(l)).ToArray();
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:6,代码来源:RealFileSystem.cs

示例11: IsFile

 public bool IsFile(FilePath target)
 {
     try
     {
         return File.Exists(target.ToEnvironmentalPath());
     }
     catch
     {
         return false;
     }
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:11,代码来源:RealFileSystem.cs

示例12: CloneMissingRepos

        void CloneMissingRepos()
        {
            for (int i = 0; i < Modules.Paths.Length; i++)
            {
                var path = new FilePath(Modules.Paths[i]);
                var expected = _rootPath.Navigate(path);
                if (_files.Exists(expected)) continue;

                Log.Info(path.ToEnvironmentalPath() + " is missing. Cloning...");
                _git.Clone(_rootPath, expected, Modules.Repos[i]);
            }
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:12,代码来源:Builder.cs

示例13: Exists

 public bool Exists(FilePath filePath)
 {
     return File.Exists(filePath.ToEnvironmentalPath())
         || Directory.Exists(filePath.ToEnvironmentalPath());
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:5,代码来源:RealFileSystem.cs

示例14: RebuildByFluentMigration

        private void RebuildByFluentMigration(FilePath projPath, FilePath psScript)
        {
            var createDatabase = projPath.Append(new FilePath("DatabaseScripts")).Append(new FilePath("CreateDatabase.sql"));
            Log.Status("Creating database from " + createDatabase.ToEnvironmentalPath());
            _builder.RunSqlScripts(projPath, createDatabase);

            Log.Status("Running RunMigrationsLocally.ps1");
            projPath.Call("powershell " + psScript.ToEnvironmentalPath(), "");
        }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:9,代码来源:Builder.cs

示例15: RunSqlScripts

 public int RunSqlScripts(FilePath root, FilePath script)
 {
     Log.Status("                           " + script.LastElement());
     return root.Call("sqlcmd.exe", "-f 65001 -i \"" + script.ToEnvironmentalPath() + "\" -S . -E");
 }
开发者ID:i-e-b,项目名称:PlatformBuild,代码行数:5,代码来源:BuildCmd.cs


注:本文中的FilePath.ToEnvironmentalPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。