Selaa lähdekoodia

http upload: fix upload location so it's actually working now

Felix Paul Kühne 12 vuotta sitten
vanhempi
commit
bd1684b8bd
2 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 2 0
      AspenProject/VLCAppDelegate.h
  2. 9 1
      AspenProject/VLCHTTPUploaderController.m

+ 2 - 0
AspenProject/VLCAppDelegate.h

@@ -14,6 +14,8 @@
     NSURL *_tempURL;
 }
 
+- (void)updateMediaList;
+
 @property (nonatomic, readonly) VLCPlaylistViewController *playlistViewController;
 
 @property (nonatomic, strong) UIWindow *window;

+ 9 - 1
AspenProject/VLCHTTPUploaderController.m

@@ -7,6 +7,7 @@
 //
 
 #import "VLCHTTPUploaderController.h"
+#import "VLCAppDelegate.h"
 
 #import "DDLog.h"
 #import "DDTTYLogger.h"
@@ -202,7 +203,10 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
 		// an empty form sent. we won't handle it.
 		return;
 	}
-	NSString* uploadDirPath = [[config documentRoot] stringByAppendingPathComponent:@"upload"];
+
+    // create the path where to store the media
+    NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString* uploadDirPath = searchPaths[0];
 
 	BOOL isDir = YES;
 	if (![[NSFileManager defaultManager]fileExistsAtPath:uploadDirPath isDirectory:&isDir ]) {
@@ -239,6 +243,10 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
 	// as the file part is over, we close the file.
 	[storeFile closeFile];
 	storeFile = nil;
+
+    /* update media library when file upload was completed */
+    VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
+    [appDelegate updateMediaList];
 }
 
 @end