Skip to content

Commit

Permalink
Fixing a iOS compile error after last refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 8, 2024
1 parent bd680ad commit 1f3d047
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/app_mobile_ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package app
#include <stdlib.h>
char *documentsPath(void);
void openURL(char *urlStr);
void sendNotification(char *title, char *content);
*/
Expand Down
5 changes: 0 additions & 5 deletions app/app_mobile_ios.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ void openURL(char *urlStr) {
[app openURL:url options:@{} completionHandler:nil];
}

char *documentsPath() {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.firstObject;
return [path UTF8String];
}
7 changes: 7 additions & 0 deletions internal/app/config_mobile_ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import (
"path/filepath"
)

/*
#include <stdlib.h>
char *documentsPath(void);
*/
import "C"

func rootConfigDir() string {
root := C.documentsPath()
return filepath.Join(C.GoString(root), "fyne")
Expand Down
9 changes: 9 additions & 0 deletions internal/app/config_mobile_ios.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build !ci && ios

#import <UIKit/UIKit.h>

char *documentsPath() {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.firstObject;
return [path UTF8String];
}

0 comments on commit 1f3d047

Please sign in to comment.