fix gracket init-file path
This commit is contained in:
parent
3cb7594793
commit
471a8bc1f8
|
@ -15,20 +15,13 @@ static int wx_in_terminal = 0;
|
|||
# define MZ_DEFINE_UTF8_MAIN
|
||||
#endif
|
||||
|
||||
#ifdef wx_x
|
||||
# define INIT_FILENAME "~/.gracketrc"
|
||||
#else
|
||||
# ifdef WIN32
|
||||
# define INIT_FILENAME "%%HOMEDIRVE%%\\%%HOMEPATH%%\\gracketrc.rktd"
|
||||
# else
|
||||
# ifdef OS_X
|
||||
# define INIT_FILENAME "~/.gracketrc"
|
||||
# else
|
||||
# define INIT_FILENAME "PREFERENCES:gracketrc.rktd"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#define GET_INIT_FILENAME get_init_filename
|
||||
struct Scheme_Env;
|
||||
static char *get_gr_init_filename(struct Scheme_Env *env);
|
||||
|
||||
#define UNIX_INIT_FILENAME "~/.gracketrc"
|
||||
#define WINDOWS_INIT_FILENAME "%%HOMEDIRVE%%\\%%HOMEPATH%%\\gracketrc.rktd"
|
||||
#define MACOS9_INIT_FILENAME "PREFERENCES:gracketrc.rktd"
|
||||
#define GET_INIT_FILENAME get_gr_init_filename
|
||||
#if WIN32
|
||||
# define NEED_CONSOLE_PRINTF
|
||||
# define DEFER_EXPLICIT_EXIT
|
||||
|
@ -48,6 +41,29 @@ static void yield_indefinitely();
|
|||
|
||||
# include "../racket/main.c"
|
||||
|
||||
static char *get_gr_init_filename(Scheme_Env *env)
|
||||
{
|
||||
char *s, *s2;
|
||||
int len, i;
|
||||
|
||||
s = get_init_filename(env);
|
||||
if (s) {
|
||||
len = strlen(s);
|
||||
for (i = len - 8; i; i--) {
|
||||
if (!strncmp(s XFORM_OK_PLUS i, "racketrc", 8)) {
|
||||
s2 = (char *)malloc(len + 2);
|
||||
memcpy(s2, s, i);
|
||||
memcpy(s2 + i + 1, s + i, len - i + 1);
|
||||
s2[i] = 'g';
|
||||
s = s2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static void yield_indefinitely()
|
||||
{
|
||||
#ifdef MZ_PRECISE_GC
|
||||
|
|
|
@ -125,16 +125,10 @@ static char *get_init_filename(Scheme_Env *env)
|
|||
extern Scheme_Object *scheme_initialize(Scheme_Env *env);
|
||||
#endif
|
||||
|
||||
#ifndef INIT_FILENAME
|
||||
# ifdef EXPAND_FILENAME_TILDE
|
||||
# define INIT_FILENAME "~/.racketrc"
|
||||
# else
|
||||
# ifdef DOS_FILE_SYSTEM
|
||||
# define INIT_FILENAME "%%HOMEDRIVE%%\\%%HOMEPATH%%\\racketrc.rktl"
|
||||
# else
|
||||
# define INIT_FILENAME "PREFERENCES:racketrc.rktl"
|
||||
# endif
|
||||
# endif
|
||||
#ifndef UNIX_INIT_FILENAME
|
||||
# define UNIX_INIT_FILENAME "~/.racketrc"
|
||||
# define WINDOWS_INIT_FILENAME "%%HOMEDIRVE%%\\%%HOMEPATH%%\\racketrc.rktd"
|
||||
# define MACOS9_INIT_FILENAME "PREFERENCES:racketrc.rktd"
|
||||
# define GET_INIT_FILENAME get_init_filename
|
||||
# define PRINTF printf
|
||||
# define PROGRAM "Racket"
|
||||
|
@ -144,6 +138,16 @@ extern Scheme_Object *scheme_initialize(Scheme_Env *env);
|
|||
# define INITIAL_NAMESPACE_MODULE "racket/init"
|
||||
#endif
|
||||
|
||||
#ifdef EXPAND_FILENAME_TILDE
|
||||
# define INIT_FILENAME UNIX_INIT_FILENAME
|
||||
#else
|
||||
# ifdef DOS_FILE_SYSTEM
|
||||
# define INIT_FILENAME WINDOWS_INIT_FILENAME
|
||||
# else
|
||||
# define INIT_FILENAME MACOS9_INIT_FILENAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define CMDLINE_FFLUSH fflush
|
||||
|
||||
#define BANNER scheme_banner()
|
||||
|
|
Loading…
Reference in New Issue
Block a user