Эх сурвалжийг харах

Verify if exists the fileName TO

Marino Faggiana 8 жил өмнө
parent
commit
c1d6265e7c

+ 19 - 0
iOSClient/Actions/CCActions.swift

@@ -233,6 +233,25 @@ class CCActions: NSObject {
  
         } else {
  
+            let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: appDelegate.activeUser, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl, isCryptoCloudMode: false);
+            let error = ocNetworking?.readFileSync("\(serverUrl)/\(fileName)");
+            
+            // Verify if exists the fileName TO
+            if error == nil {
+                
+                let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_file_already_exists_", comment: ""), preferredStyle: UIAlertControllerStyle.alert)
+                
+                let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default) {
+                    (result : UIAlertAction) -> Void in
+                }
+                
+                alertController.addAction(okAction)
+                
+                delegate.present(alertController, animated: true, completion: nil)
+                
+                return;
+            }
+            
             // Plain
             
             metadataNet.action = actionMoveFileOrFolder

+ 1 - 1
iOSClient/Networking/OCNetworking.m

@@ -54,7 +54,7 @@
         
         _delegate = delegate;
         
-        _metadataNet = [[CCMetadataNet alloc] init];
+        _metadataNet = [CCMetadataNet new];
         _metadataNet = [metadataNet copy];
         
         _activeUser = withUser;