00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if defined( __MINGW32__) || defined (WIN32)
00024
00025
00026 #include <windows.h>
00027
00028 bool chdir(const char* path)
00029 {
00030 wchar_t wstr[2048];
00031 mbstowcs(wstr,path,2048);
00032 return !SetCurrentDirectory(wstr);
00033 }
00034
00035 int mkdir(const char* path, unsigned int attribute)
00036 {
00037 wchar_t wstr[2048];
00038 mbstowcs(wstr,path,2048);
00039 return CreateDirectory(wstr,NULL);
00040 }
00041
00042 char* getcwd(char* str, unsigned int size)
00043 {
00044 wchar_t wstr[2048];
00045 GetCurrentDirectory(2048, wstr);
00046 wcstombs(str,wstr,size);
00047 return str;
00048 }
00049
00050 int isatty(int file)
00051 {
00052 return 0;
00053 }
00054
00055 void getFaustPathname(char* str, unsigned int size)
00056 {
00057 wchar_t wstr[2048];
00058 GetModuleFileName(NULL, wstr, 2048);
00059 wcstombs(str,wstr,size);
00060 }
00061
00062
00063 #else // Linux
00064
00065 #include <stdlib.h>
00066 #include <string.h>
00067 void getFaustPathname(char* str, unsigned int size)
00068 {
00069 char* path = getenv("_");
00070 if (path) {
00071 strncpy(str, path, size);
00072 } else {
00073
00074 strncpy(str, "/usr/local/bin/faust", size);
00075 }
00076 }
00077
00078 #endif
00079
00080