Example #1
0
		/// <exception cref="System.IO.IOException"></exception>
		protected internal static void CopyFile(FilePath src, FilePath dst)
		{
			FileInputStream fis = new FileInputStream(src);
			try
			{
				FileOutputStream fos = new FileOutputStream(dst);
				try
				{
					byte[] buf = new byte[4096];
					int r;
					while ((r = fis.Read(buf)) > 0)
					{
						fos.Write(buf, 0, r);
					}
				}
				finally
				{
					fos.Close();
				}
			}
			finally
			{
				fis.Close();
			}
		}
Example #2
0
		protected internal override FilePath DiscoverGitPrefix()
		{
			string path = SystemReader.GetInstance().Getenv("PATH");
			FilePath gitExe = SearchPath(path, "git");
			if (gitExe != null)
			{
				return gitExe.GetParentFile().GetParentFile();
			}
			if (SystemReader.GetInstance().IsMacOS())
			{
				// On MacOSX, PATH is shorter when Eclipse is launched from the
				// Finder than from a terminal. Therefore try to launch bash as a
				// login shell and search using that.
				//
				string w = ReadPipe(UserHome(), new string[] { "bash", "--login", "-c", "which git"
					 }, Encoding.Default.Name());
				//
				//
				if (w == null || w.Length == 0)
				{
					return null;
				}
				FilePath parentFile = new FilePath(w).GetParentFile();
				if (parentFile == null)
				{
					return null;
				}
				return parentFile.GetParentFile();
			}
			return null;
		}
Example #3
0
		/// <exception cref="System.IO.IOException"></exception>
		public static void CopyFile(FilePath sourceFile, FilePath destFile)
		{
			if (!destFile.Exists())
			{
				destFile.CreateNewFile();
			}
			FileChannel source = null;
			FileChannel destination = null;
			try
			{
				source = new FileInputStream(sourceFile).GetChannel();
				destination = new FileOutputStream(destFile).GetChannel();
				destination.TransferFrom(source, 0, source.Size());
			}
			finally
			{
				if (source != null)
				{
					source.Close();
				}
				if (destination != null)
				{
					destination.Close();
				}
			}
		}
 public virtual void TestAddUnstagedChanges()
 {
     FilePath file = new FilePath(db.WorkTree, "a.txt");
     FileUtils.CreateNewFile(file);
     PrintWriter writer = new PrintWriter(file);
     writer.Write("content");
     writer.Close();
     Git git = new Git(db);
     git.Add().AddFilepattern("a.txt").Call();
     RevCommit commit = git.Commit().SetMessage("initial commit").Call();
     TreeWalk tw = TreeWalk.ForPath(db, "a.txt", commit.Tree);
     NUnit.Framework.Assert.AreEqual("6b584e8ece562ebffc15d38808cd6b98fc3d97ea", tw.GetObjectId
         (0).GetName());
     writer = new PrintWriter(file);
     writer.Write("content2");
     writer.Close();
     commit = git.Commit().SetMessage("second commit").Call();
     tw = TreeWalk.ForPath(db, "a.txt", commit.Tree);
     NUnit.Framework.Assert.AreEqual("6b584e8ece562ebffc15d38808cd6b98fc3d97ea", tw.GetObjectId
         (0).GetName());
     commit = git.Commit().SetAll(true).SetMessage("third commit").SetAll(true).Call();
     tw = TreeWalk.ForPath(db, "a.txt", commit.Tree);
     NUnit.Framework.Assert.AreEqual("db00fd65b218578127ea51f3dffac701f12f486a", tw.GetObjectId
         (0).GetName());
 }
Example #5
0
 public virtual void FailingPathsShouldNotResultInOKReturnValue()
 {
     FilePath folder1 = new FilePath(db.WorkTree, "folder1");
     FileUtils.Mkdir(folder1);
     FilePath file = new FilePath(folder1, "file1.txt");
     Write(file, "folder1--file1.txt");
     file = new FilePath(folder1, "file2.txt");
     Write(file, "folder1--file2.txt");
     Git git = new Git(db);
     git.Add().AddFilepattern(folder1.GetName()).Call();
     RevCommit @base = git.Commit().SetMessage("adding folder").Call();
     RecursiveDelete(folder1);
     git.Rm().AddFilepattern("folder1/file1.txt").AddFilepattern("folder1/file2.txt").
         Call();
     RevCommit other = git.Commit().SetMessage("removing folders on 'other'").Call();
     git.Checkout().SetName(@base.Name).Call();
     file = new FilePath(db.WorkTree, "unrelated.txt");
     Write(file, "unrelated");
     git.Add().AddFilepattern("unrelated").Call();
     RevCommit head = git.Commit().SetMessage("Adding another file").Call();
     // Untracked file to cause failing path for delete() of folder1
     file = new FilePath(folder1, "file3.txt");
     Write(file, "folder1--file3.txt");
     ResolveMerger merger = new ResolveMerger(db, false);
     merger.SetCommitNames(new string[] { "BASE", "HEAD", "other" });
     merger.SetWorkingTreeIterator(new FileTreeIterator(db));
     bool ok = merger.Merge(head.Id, other.Id);
     NUnit.Framework.Assert.IsFalse(merger.GetFailingPaths().IsEmpty());
     NUnit.Framework.Assert.IsFalse(ok);
 }
 /// <summary>The default constructor for MockTSLCertificateSource.</summary>
 /// <remarks>The default constructor for MockTSLCertificateSource.</remarks>
 public KeyStoreCertificateSource(FilePath keyStoreFile, string keyStoreType, string
      password)
 {
     this.keyStoreFile = keyStoreFile;
     this.keyStoreType = keyStoreType;
     this.password = password;
 }
Example #7
0
		/// <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)
				{
				}
			}
		}
Example #8
0
 internal 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);
     }
 }
		public static sbyte[] ReadBytes(FilePath file)
		{
			int length = (int)file.Length();
			// should only be zero if loading from a network or similar
			System.Diagnostics.Debug.Assert((length != 0));
			sbyte[] bytes = new sbyte[length];
			int totalBytesRead = 0;
			FileInputStream inputStream = null;
			try
			{
				inputStream = new FileInputStream(file);
				while (totalBytesRead != length)
				{
					int bytesRead = inputStream.Read(bytes, totalBytesRead, length - totalBytesRead);
					if (bytesRead == -1)
					{
						break;
					}
					totalBytesRead += bytesRead;
				}
			}
			finally
			{
				if (inputStream != null)
				{
					inputStream.Close();
				}
			}
			return bytes;
		}
Example #10
0
		/// <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)
		{
			FileInputStream @in = new FileInputStream(path);
			try
			{
				long sz = @in.GetChannel().Size();
				if (sz > max)
				{
					throw new IOException(MessageFormat.Format(JGitText.Get().fileIsTooLarge, path));
				}
				byte[] buf = new byte[(int)sz];
				IOUtil.ReadFully(@in, buf, 0, buf.Length);
				return buf;
			}
			finally
			{
				try
				{
					@in.Close();
				}
				catch (IOException)
				{
				}
			}
		}
		/// <exception cref="System.IO.IOException"></exception>
		private ModuleSource LoadFromPathArray(string moduleId, Scriptable paths, object validator)
		{
			long llength = ScriptRuntime.ToUint32(ScriptableObject.GetProperty(paths, "length"));
			// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
			int ilength = llength > int.MaxValue ? int.MaxValue : (int)llength;
			for (int i = 0; i < ilength; ++i)
			{
				string path = EnsureTrailingSlash(ScriptableObject.GetTypedProperty<string>(paths, i));
				try
				{
					Uri uri = new Uri(path);
					if (!uri.IsAbsoluteUri)
					{
						uri = new FilePath(path).ToURI().Resolve(string.Empty);
					}
					ModuleSource moduleSource = LoadFromUri(uri.Resolve(moduleId), uri, validator);
					if (moduleSource != null)
					{
						return moduleSource;
					}
				}
				catch (URISyntaxException e)
				{
					throw new UriFormatException(e.Message);
				}
			}
			return null;
		}
Example #12
0
		/// <exception cref="System.IO.IOException"></exception>
		/// <exception cref="NGit.Api.Errors.NoFilepatternException"></exception>
		/// <exception cref="NGit.Api.Errors.NoHeadException"></exception>
		/// <exception cref="NGit.Api.Errors.NoMessageException"></exception>
		/// <exception cref="NGit.Api.Errors.ConcurrentRefUpdateException"></exception>
		/// <exception cref="NGit.Api.Errors.JGitInternalException"></exception>
		/// <exception cref="NGit.Api.Errors.WrongRepositoryStateException"></exception>
		public virtual void SetupRepository()
		{
			// create initial commit
			git = new Git(db);
			initialCommit = git.Commit().SetMessage("initial commit").Call();
			// create file
			indexFile = new FilePath(db.WorkTree, "a.txt");
			FileUtils.CreateNewFile(indexFile);
			PrintWriter writer = new PrintWriter(indexFile);
			writer.Write("content");
			writer.Flush();
			// add file and commit it
			git.Add().AddFilepattern("a.txt").Call();
			secondCommit = git.Commit().SetMessage("adding a.txt").Call();
			prestage = DirCache.Read(db.GetIndexFile(), db.FileSystem).GetEntry(indexFile.GetName
				());
			// modify file and add to index
			writer.Write("new content");
			writer.Close();
			git.Add().AddFilepattern("a.txt").Call();
			// create a file not added to the index
			untrackedFile = new FilePath(db.WorkTree, "notAddedToIndex.txt");
			FileUtils.CreateNewFile(untrackedFile);
			PrintWriter writer2 = new PrintWriter(untrackedFile);
			writer2.Write("content");
			writer2.Close();
		}
Example #13
0
		private static void RunFileIfExists(Context cx, Scriptable global, FilePath f)
		{
			if (f.IsFile())
			{
				Main.ProcessFileNoThrow(cx, global, f.GetPath());
			}
		}
Example #14
0
		/// <exception cref="System.IO.IOException"></exception>
		public static FilePath GetTestDir()
		{
			FilePath testDir = null;
			if (Runtime.GetProperty("mozilla.js.tests") != null)
			{
				testDir = new FilePath(Runtime.GetProperty("mozilla.js.tests"));
			}
			else
			{
				Uri url = typeof(StandardTests).GetResource(".");
				string path = url.GetFile();
				int jsIndex = path.LastIndexOf("/js");
				if (jsIndex == -1)
				{
					throw new InvalidOperationException("You aren't running the tests " + "from within the standard mozilla/js directory structure");
				}
				path = Sharpen.Runtime.Substring(path, 0, jsIndex + 3).Replace('/', FilePath.separatorChar);
				path = path.Replace("%20", " ");
				testDir = new FilePath(path, "tests");
			}
			if (!testDir.IsDirectory())
			{
				throw new FileNotFoundException(testDir + " is not a directory");
			}
			return testDir;
		}
		public virtual void TestSameDiff()
		{
			Write(new FilePath(db.Directory.GetParent(), "test.txt"), "test");
			FilePath folder = new FilePath(db.Directory.GetParent(), "folder");
			folder.Mkdir();
			Write(new FilePath(folder, "folder.txt"), "\n\n\n\nfolder");
			Git git = new Git(db);
			git.Add().AddFilepattern(".").Call();
			git.Commit().SetMessage("Initial commit").Call();
			Write(new FilePath(folder, "folder.txt"), "\n\n\n\nfolder change");
			PatchIdDiffFormatter df = new PatchIdDiffFormatter();
			df.SetRepository(db);
			df.SetPathFilter(PathFilter.Create("folder"));
			DirCacheIterator oldTree = new DirCacheIterator(db.ReadDirCache());
			FileTreeIterator newTree = new FileTreeIterator(db);
			df.Format(oldTree, newTree);
			df.Flush();
			NUnit.Framework.Assert.AreEqual("08fca5ac531383eb1da8bf6b6f7cf44411281407", df.GetCalulatedPatchId
				().Name);
			Write(new FilePath(folder, "folder.txt"), "a\n\n\n\nfolder");
			git.Add().AddFilepattern(".").Call();
			git.Commit().SetMessage("Initial commit").Call();
			Write(new FilePath(folder, "folder.txt"), "a\n\n\n\nfolder change");
			df = new PatchIdDiffFormatter();
			df.SetRepository(db);
			df.SetPathFilter(PathFilter.Create("folder"));
			oldTree = new DirCacheIterator(db.ReadDirCache());
			newTree = new FileTreeIterator(db);
			df.Format(oldTree, newTree);
			df.Flush();
			NUnit.Framework.Assert.AreEqual("08fca5ac531383eb1da8bf6b6f7cf44411281407", df.GetCalulatedPatchId
				().Name);
		}
 public override void SetUp()
 {
     base.SetUp();
     dbTarget = CreateWorkRepository();
     source = new Git(db);
     target = new Git(dbTarget);
     // put some file in the source repo
     sourceFile = new FilePath(db.WorkTree, "SomeFile.txt");
     WriteToFile(sourceFile, "Hello world");
     // and commit it
     source.Add().AddFilepattern("SomeFile.txt").Call();
     source.Commit().SetMessage("Initial commit for source").Call();
     // configure the target repo to connect to the source via "origin"
     StoredConfig targetConfig = ((FileBasedConfig)dbTarget.GetConfig());
     targetConfig.SetString("branch", "master", "remote", "origin");
     targetConfig.SetString("branch", "master", "merge", "refs/heads/master");
     RemoteConfig config = new RemoteConfig(targetConfig, "origin");
     config.AddURI(new URIish(source.GetRepository().WorkTree.GetPath()));
     config.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
     config.Update(targetConfig);
     targetConfig.Save();
     targetFile = new FilePath(dbTarget.WorkTree, "SomeFile.txt");
     // make sure we have the same content
     target.Pull().Call();
     target.Checkout().SetStartPoint("refs/remotes/origin/master").SetName("master").Call
         ();
     targetConfig.SetString("branch", "master", "merge", "refs/heads/master");
     targetConfig.SetBoolean("branch", "master", "rebase", true);
     targetConfig.Save();
     AssertFileContentsEqual(targetFile, "Hello world");
 }
Example #17
0
		public static BlobKey KeyForBlobFromFile(FilePath file)
		{
			MessageDigest md;
			try
			{
				md = MessageDigest.GetInstance("SHA-1");
			}
			catch (NoSuchAlgorithmException)
			{
				Log.E(Database.Tag, "Error, SHA-1 digest is unavailable.");
				return null;
			}
			byte[] sha1hash = new byte[40];
			try
			{
				FileInputStream fis = new FileInputStream(file);
				byte[] buffer = new byte[65536];
				int lenRead = fis.Read(buffer);
				while (lenRead > 0)
				{
					md.Update(buffer, 0, lenRead);
					lenRead = fis.Read(buffer);
				}
				fis.Close();
			}
			catch (IOException)
			{
				Log.E(Database.Tag, "Error readin tmp file to compute key");
			}
			sha1hash = md.Digest();
			BlobKey result = new BlobKey(sha1hash);
			return result;
		}
Example #18
0
		public virtual void TestDeleteFile()
		{
			FilePath f = new FilePath(trash, "test");
			FileUtils.CreateNewFile(f);
			FileUtils.Delete(f);
			NUnit.Framework.Assert.IsFalse(f.Exists());
			try
			{
				FileUtils.Delete(f);
				NUnit.Framework.Assert.Fail("deletion of non-existing file must fail");
			}
			catch (IOException)
			{
			}
			// expected
			try
			{
				FileUtils.Delete(f, FileUtils.SKIP_MISSING);
			}
			catch (IOException)
			{
				NUnit.Framework.Assert.Fail("deletion of non-existing file must not fail with option SKIP_MISSING"
					);
			}
		}
Example #19
0
		/// <summary>The constructor</summary>
		/// <param name="base">the base configuration file</param>
		/// <param name="cfgLocation">the location of the configuration file on the file system
		/// 	</param>
		/// <param name="fs">
		/// the file system abstraction which will be necessary to perform
		/// certain file system operations.
		/// </param>
		public FileBasedConfig(Config @base, FilePath cfgLocation, FS fs) : base(@base)
		{
			configFile = cfgLocation;
			this.fs = fs;
			this.snapshot = FileSnapshot.DIRTY;
			this.hash = ObjectId.ZeroId;
		}
Example #20
0
		public virtual void Test001_Initalize()
		{
			FilePath gitdir = new FilePath(trash, Constants.DOT_GIT);
			FilePath hooks = new FilePath(gitdir, "hooks");
			FilePath objects = new FilePath(gitdir, "objects");
			FilePath objects_pack = new FilePath(objects, "pack");
			FilePath objects_info = new FilePath(objects, "info");
			FilePath refs = new FilePath(gitdir, "refs");
			FilePath refs_heads = new FilePath(refs, "heads");
			FilePath refs_tags = new FilePath(refs, "tags");
			FilePath HEAD = new FilePath(gitdir, "HEAD");
			NUnit.Framework.Assert.IsTrue(trash.IsDirectory(), "Exists " + trash);
			NUnit.Framework.Assert.IsTrue(hooks.IsDirectory(), "Exists " + hooks);
			NUnit.Framework.Assert.IsTrue(objects.IsDirectory(), "Exists " + objects);
			NUnit.Framework.Assert.IsTrue(objects_pack.IsDirectory(), "Exists " + objects_pack
				);
			NUnit.Framework.Assert.IsTrue(objects_info.IsDirectory(), "Exists " + objects_info
				);
			NUnit.Framework.Assert.AreEqual(2L, objects.ListFiles().Length);
			NUnit.Framework.Assert.IsTrue(refs.IsDirectory(), "Exists " + refs);
			NUnit.Framework.Assert.IsTrue(refs_heads.IsDirectory(), "Exists " + refs_heads);
			NUnit.Framework.Assert.IsTrue(refs_tags.IsDirectory(), "Exists " + refs_tags);
			NUnit.Framework.Assert.IsTrue(HEAD.IsFile(), "Exists " + HEAD);
			NUnit.Framework.Assert.AreEqual(23, HEAD.Length());
		}
		/// <exception cref="System.IO.IOException"></exception>
		public virtual void StartVisitTree(Tree t)
		{
			stack.AddItem(currentDirectory);
			if (!t.IsRoot())
			{
				currentDirectory = new FilePath(currentDirectory, t.GetName());
			}
		}
Example #22
0
		public PrintWriter (FilePath path)
		{
			#if PORTABLE
			writer = new StreamWriter(Couchbase.Lite.File.OpenStream(path, true));
			#else
			writer = new StreamWriter (path);
			#endif
		}
Example #23
0
		public virtual void TestReadMissing_RealIndex()
		{
			FilePath idx = new FilePath(db.Directory, "index");
			NUnit.Framework.Assert.IsFalse(idx.Exists());
			DirCache dc = db.ReadDirCache();
			NUnit.Framework.Assert.IsNotNull(dc);
			NUnit.Framework.Assert.AreEqual(0, dc.GetEntryCount());
		}
Example #24
0
		/// <summary>Create a new lock for a pack file.</summary>
		/// <remarks>Create a new lock for a pack file.</remarks>
		/// <param name="packFile">location of the <code>pack-*.pack</code> file.</param>
		/// <param name="fs">the filesystem abstraction used by the repository.</param>
		public PackLock(FilePath packFile, FS fs)
		{
			FilePath p = packFile.GetParentFile();
			string n = packFile.GetName();
			keepFile = new FilePath(p, Sharpen.Runtime.Substring(n, 0, n.Length - 5) + ".keep"
				);
			this.fs = fs;
		}
Example #25
0
		public virtual void TestReadMissing_TempIndex()
		{
			FilePath idx = new FilePath(db.Directory, "tmp_index");
			NUnit.Framework.Assert.IsFalse(idx.Exists());
			DirCache dc = DirCache.Read(idx, db.FileSystem);
			NUnit.Framework.Assert.IsNotNull(dc);
			NUnit.Framework.Assert.AreEqual(0, dc.GetEntryCount());
		}
Example #26
0
		/// <exception cref="System.IO.FileNotFoundException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		internal static DirCacheEditor.PathEdit Add(Repository db, FilePath workdir, string
			 path)
		{
			ObjectInserter inserter = db.NewObjectInserter();
			FilePath f = new FilePath(workdir, path);
			ObjectId id = inserter.Insert(Constants.OBJ_BLOB, IOUtil.ReadFully(f));
			return new _PathEdit_81(f, id, path);
		}
		public virtual void TestShouldAutomagicallyDetectGitDirectory()
		{
			FileRepository r = CreateWorkRepository();
			FilePath d = new FilePath(r.Directory, "sub-dir");
			FileUtils.Mkdir(d);
			NUnit.Framework.Assert.AreEqual(r.Directory, new FileRepositoryBuilder().FindGitDir
				(d).GetGitDir());
		}
Example #28
0
		/// <exception cref="System.IO.IOException"></exception>
		public static string LoadFile(FilePath f)
		{
			int length = (int)f.Length();
			// don't worry about very long files
			char[] buf = new char[length];
			new FileReader(f).Read(buf, 0, length);
			return new string(buf);
		}
Example #29
0
		/// <summary>Create a FileDocument</summary>
		/// <param name="file"></param>
		public FileDocument(FilePath file)
		{
			if (!file.Exists())
			{
				throw new RuntimeException("File Not Found");
			}
			this.file = file;
		}
 public virtual FilePath GetRootDirectory()
 {
     string rootDirectoryPath = Runtime.GetProperty("user.dir");
     FilePath rootDirectory = new FilePath(rootDirectoryPath);
     rootDirectory = new FilePath(rootDirectory, "data/data/com.couchbase.lite.test/files"
         );
     return rootDirectory;
 }
 public virtual bool CanExecute(FilePath path)
 {
     return(false);
 }
 public virtual bool Exists(FilePath path)
 {
     return(File.Exists(path) || Directory.Exists(path));
 }
 public virtual bool IsDirectory(FilePath path)
 {
     return(Directory.Exists(path));
 }
 public virtual bool IsFile(FilePath path)
 {
     return(File.Exists(path));
 }
 public virtual bool SetExecutable(FilePath path, bool exec)
 {
     return(false);
 }
 public virtual bool CanWrite(FilePath path)
 {
     return((File.GetAttributes(path) & FileAttributes.ReadOnly) == 0);
 }