use $HOME/Downloads folder

APPLEMAIL-28
Volker Birk 2020-06-13 14:23:25 +02:00
parent 3564ae1e11
commit 525ff6c99c
4 changed files with 31 additions and 8 deletions

View File

@ -56,6 +56,18 @@ extern pEpUpdater* updater;
if (updater) [updater updateAll:nil];
}
- (void)scheduleUpdates
{
NSLog(@"scheduleUpdates called");
if (updater) [updater scheduleUpdates];
}
- (void)stopUpdates
{
NSLog(@"stopUpdates called");
if (updater) [updater stopUpdates];
}
// end pEpMacOSAdapterProtocol
@end

View File

@ -41,4 +41,10 @@ typedef enum { ready = 0, downloading, downloadArrived, noDownloadAvailable } DN
/// search for immediate updates
- (void)updateNow;
/// schedules updates each 2 hours
- (void)scheduleUpdates;
/// stop auto updates
- (void)stopUpdates;
@end

View File

@ -28,6 +28,9 @@
/// schedules updates each 2 hours
- (void)scheduleUpdates;
/// stop auto updates
- (void)stopUpdates;
/// update all configured software
- (void)updateAll:(NSTimer*)timer;

View File

@ -22,7 +22,6 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
if (self) {
self.configPath = CONFIG_PATH;
}
[self scheduleUpdates];
return self;
}
@ -101,11 +100,14 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
NSLog(@"using key from %s", keyfile.c_str());
NSFileManager *localFileManager=[NSFileManager new];
NSString* cwd = localFileManager.currentDirectoryPath;
NSString* tmp = NSTemporaryDirectory();
[localFileManager changeCurrentDirectoryPath:tmp];
NSString* cwd = [NSFileManager defaultManager].currentDirectoryPath;
NSURL* dirurl = [[[NSFileManager defaultManager]
URLsForDirectory:NSDownloadsDirectory inDomains:NSUserDomainMask]
lastObject];
NSString* dir = [dirurl path];
[[NSFileManager defaultManager] changeCurrentDirectoryPath:dir];
std::string _filename;
pEp::notifyRead_t notifyRead = [=]()->void{
@ -120,8 +122,8 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
if (_filename.length()) {
NSString* filename = [NSString stringWithUTF8String:_filename.c_str()];
NSString* download = [NSString stringWithFormat:@"%@/%@", tmp, filename];
[localFileManager changeCurrentDirectoryPath:cwd];
NSString* download = [NSString stringWithFormat:@"%@/%@", dir, filename];
[[NSFileManager defaultManager] changeCurrentDirectoryPath:cwd];
NSLog(@"download arrived %@", download);
if (_subscriber) {