Gary-Hobson commented on code in PR #8868: URL: https://github.com/apache/nuttx/pull/8868#discussion_r1163543146
########## arch/sim/src/sim/posix/sim_hostfs.c: ########## @@ -36,10 +36,66 @@ #include "hostfs.h" +#ifdef CONFIG_HOST_MACOS +#include <sys/syslimits.h> +#include <mach-o/dyld.h> +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: host_path_convert + ****************************************************************************/ + +static int host_path_convert(const char *path, char *abspath, + uint32_t buflen) +{ +#ifndef CONFIG_SIM_HOSTFS_PATH_CONVERSION + strncpy(abspath, path, buflen); + abspath[buflen - 1] = '\0'; + return 0; +#else + int ret; + char *name; + + if (path[0] == '/') + { + strncpy(abspath, path, buflen); + abspath[buflen - 1] = '\0'; + return 0; + } + + /* Get the absolute path of the executable file */ + +# ifdef CONFIG_HOST_LINUX + ret = readlink("/proc/self/exe", abspath, buflen); Review Comment: Just using chdir doesn't solve the problem, Because its problem is how to provide a fixed path as the starting search location. chdir still uses $CWD as the starting path, and the results of executing nuttx in different paths are still different. So we need to get the folder where the nuttx file is located as the starting path -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org