Browse Source

use $HOME/Downloads folder

works_for_me
Volker Birk 2 years ago
parent
commit
525ff6c99c
4 changed files with 31 additions and 8 deletions
  1. +12
    -0
      pEpMacOSAdapter/pEpMacOSAdapter.m
  2. +6
    -0
      pEpMacOSAdapter/pEpMacOSAdapterProtocol.h
  3. +3
    -0
      pEpMacOSAdapter/pEpUpdater.h
  4. +10
    -8
      pEpMacOSAdapter/pEpUpdater.mm

+ 12
- 0
pEpMacOSAdapter/pEpMacOSAdapter.m 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

+ 6
- 0
pEpMacOSAdapter/pEpMacOSAdapterProtocol.h 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

+ 3
- 0
pEpMacOSAdapter/pEpUpdater.h 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;


+ 10
- 8
pEpMacOSAdapter/pEpUpdater.mm 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) {


Loading…
Cancel
Save