summaryrefslogtreecommitdiff
path: root/scon.c
diff options
context:
space:
mode:
Diffstat (limited to 'scon.c')
-rw-r--r--scon.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/scon.c b/scon.c
index 8ede910..405d67f 100644
--- a/scon.c
+++ b/scon.c
@@ -771,6 +771,7 @@ void create_profile_file_name (unsigned char *profile_file_name_string)
profile_file_name=&profile_file_name_string[2*sizeof(size_t)];
+# ifndef MACH_O64
r=readlink ("/proc/self/exe",profile_file_name,MY_PATH_MAX-1);
if (r>=0){
int length_file_name,size_time_profile_file_name_suffix;
@@ -790,7 +791,35 @@ void create_profile_file_name (unsigned char *profile_file_name_string)
} else {
strcpy (profile_file_name,&time_profile_file_name_suffix[1]);
*(size_t*)&profile_file_name_string[sizeof(size_t)] = sizeof (time_profile_file_name_suffix)-1;
+ }
+# else
+ {
+ uint32_t buf_size;
+ char exec_path[MY_PATH_MAX];
+
+ buf_size=MY_PATH_MAX;
+ r=_NSGetExecutablePath (exec_path,&buf_size);
+ if (r==0){
+ int length_file_name,size_time_profile_file_name_suffix;
+
+ size_time_profile_file_name_suffix=sizeof (time_profile_file_name_suffix);
+ length_file_name=0;
+ while (profile_file_name[length_file_name]!='\0')
+ ++length_file_name;
+
+ if (length_file_name+size_time_profile_file_name_suffix>MY_PATH_MAX)
+ length_file_name=MY_PATH_MAX-size_time_profile_file_name_suffix;
+
+ strcat (&profile_file_name[length_file_name],time_profile_file_name_suffix);
+ *(size_t*)&profile_file_name_string[sizeof(size_t)] = length_file_name+size_time_profile_file_name_suffix-1;
+ } else {
+ profile_file_name[0]='\0';
+
+ strcpy (profile_file_name,&time_profile_file_name_suffix[1]);
+ *(size_t*)&profile_file_name_string[sizeof(size_t)] = sizeof (time_profile_file_name_suffix)-1;
+ }
}
+# endif
}
#endif