Commit bcbb0649 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov

[ios] utils

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64856 954022d7-b5bf-4e40-9824-e11837661b57
parent f218af78
//
// NSFileManager+Utils.h
// Utils
//
// Created by alexey.musinov on 21.09.15.
// Copyright © 2015 Ascensio System SIA. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSFileManager (Utils)
- (BOOL)copyFolderAtPath:(NSString *)sourceFolder toDestinationFolderAtPath:(NSString*)destinationFolder;
@end
//
// NSFileManager+Utils.m
// Utils
//
// Created by alexey.musinov on 21.09.15.
// Copyright © 2015 Ascensio System SIA. All rights reserved.
//
#import "NSFileManager+Utils.h"
@implementation NSFileManager(Utils)
- (BOOL)copyFolderAtPath:(NSString*)sourceFolder toDestinationFolderAtPath:(NSString*)destinationFolder {
destinationFolder = [destinationFolder stringByAppendingPathComponent:[sourceFolder lastPathComponent]];
NSError * error = nil;
if ([self fileExistsAtPath:destinationFolder])
{
if (![self removeItemAtPath:destinationFolder error:&error])
{
NSLog(@"Could not remove old files. Error:%@",error);
return NO;
}
}
error = nil;
if (!([self copyItemAtPath:sourceFolder toPath:destinationFolder error:&error]))
{
NSLog(@"Could not copy report at path %@ to path %@. error %@",sourceFolder, destinationFolder, error);
return NO;
}
return YES;
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment