backend: Add IsUsablePath method and adjust related TODOs
This commit is contained in:
parent
d7b488f2ff
commit
ae20120723
|
@ -20,6 +20,8 @@ using System.IO;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
|
// An inheritable class that contains information
|
||||||
|
// about a backend
|
||||||
public class SparkleBackend {
|
public class SparkleBackend {
|
||||||
|
|
||||||
public static SparkleBackend DefaultBackend;
|
public static SparkleBackend DefaultBackend;
|
||||||
|
@ -41,10 +43,16 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool IsPresent {
|
virtual public bool IsPresent {
|
||||||
get {
|
get {
|
||||||
return (Path != null);
|
return (Path != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual public bool IsUsablePath (string path)
|
||||||
|
{
|
||||||
|
return (path.Length > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,9 +135,11 @@ namespace SparkleShare {
|
||||||
FolderSizeChanged (FolderSize);
|
FolderSizeChanged (FolderSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Only support removing because 1. removing causes crashes and 2. Backend will be determined in
|
||||||
|
// the Intro and added to a table with the repo type, so we wont' know what type will be added
|
||||||
|
|
||||||
// Add the repository when a create event occurs
|
// Add the repository when a create event occurs
|
||||||
watcher.Created += delegate (object o, FileSystemEventArgs args) {
|
watcher.Created += delegate (object o, FileSystemEventArgs args) {
|
||||||
// TODO: Needs to wait until the copying over is done
|
|
||||||
|
|
||||||
// Handle invitations when the user saves an
|
// Handle invitations when the user saves an
|
||||||
// invitation into the SparkleShare folder
|
// invitation into the SparkleShare folder
|
||||||
|
@ -472,10 +474,15 @@ namespace SparkleShare {
|
||||||
// Adds a repository to the list of repositories
|
// Adds a repository to the list of repositories
|
||||||
private void AddRepository (string folder_path)
|
private void AddRepository (string folder_path)
|
||||||
{
|
{
|
||||||
// Check if the folder is a Git repository
|
// TODO: determine the backend type here
|
||||||
|
// need to keep track of a table with folder+backendtype
|
||||||
|
// and use GitBackend.IsValidFolder (string path);
|
||||||
|
|
||||||
|
// Check if the folder is a Git repository TODO: remove later
|
||||||
if (!SparkleRepo.IsRepo (folder_path))
|
if (!SparkleRepo.IsRepo (folder_path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
SparkleRepo repo = new SparkleRepo (folder_path, SparkleBackend.DefaultBackend);
|
SparkleRepo repo = new SparkleRepo (folder_path, SparkleBackend.DefaultBackend);
|
||||||
|
|
||||||
repo.NewCommit += delegate (SparkleCommit commit, string repository_path) {
|
repo.NewCommit += delegate (SparkleCommit commit, string repository_path) {
|
||||||
|
|
Loading…
Reference in a new issue