Microsoft.Scripting.PlatformAdaptationLayer.IsAbsolutePath C# (CSharp) Method

IsAbsolutePath() public method

Invalid path.
public IsAbsolutePath ( string path ) : bool
path string
return bool
        public virtual bool IsAbsolutePath(string path) {
#if !SILVERLIGHT
            // GetPathRoot returns either :
            // "" -> relative to the current dir
            // "\" -> relative to the drive of the current dir
            // "X:" -> relative to the current dir, possibly on a different drive
            // "X:\" -> absolute
            if (IsSingleRootFileSystem) {
                return Path.IsPathRooted(path);
            }
            var root = Path.GetPathRoot(path);
            return root.EndsWith(@":\") || root.EndsWith(@":/");
#else
            throw new NotImplementedException();
#endif
        }

Usage Example

コード例 #1
0
ファイル: RubyProcess.cs プロジェクト: atczyc/ironruby
        private static IEnumerable<string>/*!*/ GetAbsolutePaths(PlatformAdaptationLayer/*!*/ pal, string/*!*/ path) {
            if (pal.IsAbsolutePath(path)) {
                yield return path;
            } else {
                yield return pal.GetFullPath(path);

                string var = pal.GetEnvironmentVariable("PATH");
                if (!String.IsNullOrEmpty(var)) {
                    foreach (var prefix in var.Split(Path.PathSeparator)) {
                        if (prefix.Length > 0) {
                            yield return Path.Combine(prefix, path);
                        }
                    }
                }

                var = Environment.GetFolderPath(Environment.SpecialFolder.System);
                if (!String.IsNullOrEmpty(var)) {
                    yield return Path.Combine(var, path);
                }

                var = pal.GetEnvironmentVariable("SystemRoot");
                if (!String.IsNullOrEmpty(var)) {
                    yield return Path.Combine(var, path);
                }
            }
        }