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


C# FilePath.GetPath方法代码示例

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


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

示例1: Exec

		public SystemProcess Exec (string[] cmd, string[] envp, FilePath dir)
		{
			try {
				ProcessStartInfo psi = new ProcessStartInfo ();
				psi.FileName = cmd[0];
				psi.Arguments = string.Join (" ", cmd, 1, cmd.Length - 1);
				if (dir != null) {
					psi.WorkingDirectory = dir.GetPath ();
				}
				psi.UseShellExecute = false;
				psi.RedirectStandardInput = true;
				psi.RedirectStandardError = true;
				psi.RedirectStandardOutput = true;
				psi.CreateNoWindow = true;
				if (envp != null) {
					foreach (string str in envp) {
						int index = str.IndexOf ('=');
						psi.EnvironmentVariables[str.Substring (0, index)] = str.Substring (index + 1);
					}
				}
				return SystemProcess.Start (psi);
			} catch (System.ComponentModel.Win32Exception ex) {
				throw new IOException (ex.Message);
			}
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:25,代码来源:Runtime.cs

示例2: RunFileIfExists

		private static void RunFileIfExists(Context cx, Scriptable global, FilePath f)
		{
			if (f.IsFile())
			{
				Main.ProcessFileNoThrow(cx, global, f.GetPath());
			}
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:ShellTest.cs

示例3: DeleteRecursive

 public static bool DeleteRecursive (FilePath attachmentsFile)
 {
     var success = true;
     try {
         Directory.Delete (attachmentsFile.GetPath (), true);
     } catch (Exception ex) {
         Log.V(Tag, "Error deleting the '{0}' directory.".Fmt(attachmentsFile.GetAbsolutePath()), ex);
         success = false;
     }
     return success;
 }
开发者ID:FireflyLogic,项目名称:couchbase-lite-net,代码行数:11,代码来源:FileDirUtils.cs

示例4: Exec

		public Process Exec (string[] cmd, string[] envp, FilePath dir)
		{
			Process process = new Process ();
			process.StartInfo.FileName = cmd[0];
			process.StartInfo.Arguments = string.Join (" ", cmd, 1, cmd.Length - 1);
			if (dir != null) {
				process.StartInfo.WorkingDirectory = dir.GetPath ();
			}
			process.StartInfo.UseShellExecute = false;
			if (envp != null) {
				foreach (string str in envp) {
					int index = str.IndexOf ('=');
					process.StartInfo.EnvironmentVariables[str.Substring (0, index)] = str.Substring (index + 1);
				}
			}
			process.Start ();
			return process;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:18,代码来源:Runtime.cs

示例5: RandomAccessFile

		public RandomAccessFile (FilePath file, string mode) : this(file.GetPath (), mode)
		{
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:3,代码来源:RandomAccessFile.cs

示例6: FileOutputStream

 public FileOutputStream (FilePath file): this (file.GetPath (), false)
 {
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:3,代码来源:FileOutputStream.cs

示例7: PrintWriter

		public PrintWriter (FilePath path) : base(path.GetPath ())
		{
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:3,代码来源:PrintWriter.cs

示例8: CheckoutEntry

        /// <summary>
        /// Updates the file in the working tree with content and mode from an entry
        /// in the index.
        /// </summary>
        /// <remarks>
        /// Updates the file in the working tree with content and mode from an entry
        /// in the index. The new content is first written to a new temporary file in
        /// the same directory as the real file. Then that new file is renamed to the
        /// final filename.
        /// <p>
        /// TODO: this method works directly on File IO, we may need another
        /// abstraction (like WorkingTreeIterator). This way we could tell e.g.
        /// Eclipse that Files in the workspace got changed
        /// </p>
        /// </remarks>
        /// <param name="repo"></param>
        /// <param name="f">
        /// the file to be modified. The parent directory for this file
        /// has to exist already
        /// </param>
        /// <param name="entry">the entry containing new mode and content</param>
        /// <param name="or">object reader to use for checkout</param>
        /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
        public static void CheckoutEntry(Repository repo, FilePath f, DirCacheEntry entry
			, ObjectReader or)
        {
            ObjectLoader ol = or.Open(entry.GetObjectId());
            FilePath parentDir = f.GetParentFile();
            FilePath tmpFile = FilePath.CreateTempFile("._" + f.GetName(), null, parentDir);
            WorkingTreeOptions opt = repo.GetConfig().Get(WorkingTreeOptions.KEY);
            FileOutputStream rawChannel = new FileOutputStream(tmpFile);
            OutputStream channel;
            if (opt.GetAutoCRLF() == CoreConfig.AutoCRLF.TRUE)
            {
                channel = new AutoCRLFOutputStream(rawChannel);
            }
            else
            {
                channel = rawChannel;
            }
            try
            {
                ol.CopyTo(channel);
            }
            finally
            {
                channel.Close();
            }
            FS fs = repo.FileSystem;
            if (opt.IsFileMode() && fs.SupportsExecute())
            {
                if (FileMode.EXECUTABLE_FILE.Equals(entry.RawMode))
                {
                    if (!fs.CanExecute(tmpFile))
                    {
                        fs.SetExecute(tmpFile, true);
                    }
                }
                else
                {
                    if (fs.CanExecute(tmpFile))
                    {
                        fs.SetExecute(tmpFile, false);
                    }
                }
            }
            if (!tmpFile.RenameTo(f))
            {
                // tried to rename which failed. Let' delete the target file and try
                // again
                FileUtils.Delete(f);
                if (!tmpFile.RenameTo(f))
                {
                    throw new IOException(MessageFormat.Format(JGitText.Get().couldNotWriteFile, tmpFile
                        .GetPath(), f.GetPath()));
                }
            }
            entry.LastModified = f.LastModified();
            if (opt.GetAutoCRLF() != CoreConfig.AutoCRLF.FALSE)
            {
                entry.SetLength(f.Length());
            }
            else
            {
                // AutoCRLF wants on-disk-size
                entry.SetLength((int)ol.GetSize());
            }
        }
开发者ID:stinos,项目名称:ngit,代码行数:88,代码来源:DirCacheCheckout.cs

示例9: Delete

        /// <summary>
        /// Deletes the %Database%.
        /// </summary>
        /// <exception cref="Couchbase.Lite.CouchbaseLiteException"/>
        public void Delete()
        {
            if (open)
            {
                if (!Close())
                {
                    throw new CouchbaseLiteException("The database was open, and could not be closed", 
                        StatusCode.InternalServerError);
                }
            }

            Manager.ForgetDatabase(this);
            if (!Exists())
            {
                return;
            }

            var file = new FilePath(Path);
            var attachmentsFile = new FilePath(AttachmentStorePath);

            var deleteStatus = file.Delete();
            if (!deleteStatus)
            {
                Log.V(Database.Tag, String.Format("Error deleting the SQLite database file at {0}", file.GetAbsolutePath()));
            }

            //recursively delete attachments path
            var deletedAttachmentsPath = true;
            try {
				var dirInfo = new DirectoryInfo(attachmentsFile.GetPath());
				dirInfo.Delete(true);
				//Directory.Delete (attachmentsFile.GetPath (), true);
            } catch (Exception ex) {
                Log.V(Database.Tag, "Error deleting the attachments directory.", ex);
                deletedAttachmentsPath = false;
            }

            if (!deleteStatus)
            {
                throw new CouchbaseLiteException("Was not able to delete the database file", StatusCode.InternalServerError);
            }

            if (!deletedAttachmentsPath)
            {
                throw new CouchbaseLiteException("Was not able to delete the attachments files", StatusCode.InternalServerError);
            }
        }
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:51,代码来源:Database.cs

示例10: FileReader

		public FileReader (FilePath f) : base(f.GetPath ())
		{
		}
开发者ID:renaud91,项目名称:n-metadata-extractor,代码行数:3,代码来源:FileReader.cs

示例11: FileInputStream

 public FileInputStream (FilePath file) : this(file.GetPath ())
 {
 }
开发者ID:DotNetEra,项目名称:couchbase-lite-net,代码行数:3,代码来源:FileInputStream.cs

示例12: FsTick

		/// <summary>
		/// Waits until it is guaranteed that a subsequent file modification has a
		/// younger modification timestamp than the modification timestamp of the
		/// given file.
		/// </summary>
		/// <remarks>
		/// Waits until it is guaranteed that a subsequent file modification has a
		/// younger modification timestamp than the modification timestamp of the
		/// given file. This is done by touching a temporary file, reading the
		/// lastmodified attribute and, if needed, sleeping. After sleeping this loop
		/// starts again until the filesystem timer has advanced enough.
		/// </remarks>
		/// <param name="lastFile">
		/// the file on which we want to wait until the filesystem timer
		/// has advanced more than the lastmodification timestamp of this
		/// file
		/// </param>
		/// <returns>
		/// return the last measured value of the filesystem timer which is
		/// greater than then the lastmodification time of lastfile.
		/// </returns>
		/// <exception cref="System.Exception">System.Exception</exception>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		public static long FsTick(FilePath lastFile)
		{
			long sleepTime = 1;
			if (lastFile != null && !lastFile.Exists())
			{
				throw new FileNotFoundException(lastFile.GetPath());
			}
			FilePath tmp = FilePath.CreateTempFile("FileTreeIteratorWithTimeControl", null);
			try
			{
				long startTime = (lastFile == null) ? tmp.LastModified() : lastFile.LastModified(
					);
				long actTime = tmp.LastModified();
				while (actTime <= startTime)
				{
					Sharpen.Thread.Sleep(sleepTime);
					sleepTime *= 5;
					tmp.SetLastModified(Runtime.CurrentTimeMillis());
					actTime = tmp.LastModified();
				}
				return actTime;
			}
			finally
			{
				FileUtils.Delete(tmp);
			}
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:50,代码来源:RepositoryTestCase.cs

示例13: RepositoryNotFoundException

		/// <summary>Constructs an exception indicating a local repository does not exist.</summary>
		/// <remarks>Constructs an exception indicating a local repository does not exist.</remarks>
		/// <param name="location">description of the repository not found, usually file path.
		/// 	</param>
		/// <param name="why">why the repository does not exist.</param>
		public RepositoryNotFoundException(FilePath location, Exception why) : this(location
			.GetPath(), why)
		{
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:9,代码来源:RepositoryNotFoundException.cs

示例14: ReadFully

 ///// <summary>Read at most limit bytes from the local file into memory as a byte array.
 ///// 	</summary>
 ///// <remarks>Read at most limit bytes from the local file into memory as a byte array.
 ///// 	</remarks>
 ///// <param name="path">location of the file to read.</param>
 ///// <param name="limit">
 ///// maximum number of bytes to read, if the file is larger than
 ///// only the first limit number of bytes are returned
 ///// </param>
 ///// <returns>
 ///// complete contents of the requested local file. If the contents
 ///// exceeds the limit, then only the limit is returned.
 ///// </returns>
 ///// <exception cref="System.IO.FileNotFoundException">the file does not exist.</exception>
 ///// <exception cref="System.IO.IOException">the file exists, but its contents cannot be read.
 ///// 	</exception>
 //public static byte[] ReadSome(FilePath path, int limit)
 //{
 //    FileInputStream @in = new FileInputStream(path);
 //    try
 //    {
 //        byte[] buf = new byte[limit];
 //        int cnt = 0;
 //        for (; ; )
 //        {
 //            int n = @in.Read(buf, cnt, buf.Length - cnt);
 //            if (n <= 0)
 //            {
 //                break;
 //            }
 //            cnt += n;
 //        }
 //        if (cnt == buf.Length)
 //        {
 //            return buf;
 //        }
 //        byte[] res = new byte[cnt];
 //        System.Array.Copy(buf, 0, res, 0, cnt);
 //        return res;
 //    }
 //    finally
 //    {
 //        try
 //        {
 //            @in.Close();
 //        }
 //        catch (IOException)
 //        {
 //        }
 //    }
 //}
 //// do nothing
 ///// <summary>Read an entire local file into memory as a byte array.</summary>
 ///// <remarks>Read an entire local file into memory as a byte array.</remarks>
 ///// <param name="path">location of the file to read.</param>
 ///// <param name="max">
 ///// maximum number of bytes to read, if the file is larger than
 ///// this limit an IOException is thrown.
 ///// </param>
 ///// <returns>complete contents of the requested local file.</returns>
 ///// <exception cref="System.IO.FileNotFoundException">the file does not exist.</exception>
 ///// <exception cref="System.IO.IOException">the file exists, but its contents cannot be read.
 ///// 	</exception>
 public static byte[] ReadFully(FilePath path, int max)
 {
     return File.ReadAllBytes(path.GetPath());
 }
开发者ID:modulexcite,项目名称:NGitDiff,代码行数:67,代码来源:IOUtil.cs

示例15: FileWriter

		public FileWriter (FilePath path) : base(Couchbase.Lite.File.OpenStream(path.GetPath (), true))
		{
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:3,代码来源:FileWriter.cs


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