[banshee] LibraryWatcher: Guard against blank or non-existent dirs
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] LibraryWatcher: Guard against blank or non-existent dirs
- Date: Tue, 22 Mar 2011 15:33:24 +0000 (UTC)
commit a3ee4f799449f946849b08c204a2ca41451ec93b
Author: Gabriel Burt <gabriel burt gmail com>
Date: Tue Mar 22 10:32:35 2011 -0500
LibraryWatcher: Guard against blank or non-existent dirs
.../Banshee.LibraryWatcher/SourceWatcher.cs | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs b/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
index 94185fd..bb146cc 100644
--- a/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
+++ b/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
@@ -75,6 +75,10 @@ namespace Banshee.LibraryWatcher
this.library = library;
handle = new ManualResetEvent(false);
string path = library.BaseDirectoryWithSeparator;
+ if (String.IsNullOrEmpty (path)) {
+ throw new Exception ("Will not create LibraryWatcher for the blank directory");
+ }
+
string home = Environment.GetFolderPath (Environment.SpecialFolder.Personal) + Path.DirectorySeparatorChar;
if (path == home) {
throw new Exception ("Will not create LibraryWatcher for the entire home directory");
@@ -85,6 +89,10 @@ namespace Banshee.LibraryWatcher
throw new Exception ("Will not create LibraryWatcher for the entire root directory");
}
+ if (!Banshee.IO.Directory.Exists (path)) {
+ throw new Exception ("Will not create LibraryWatcher for non-existent directory");
+ }
+
import_manager = ServiceManager.Get<LibraryImportManager> ();
watcher = new FileSystemWatcher (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]