19 static char buf[512] = {0};
22 char pathbuffer[_MAX_PATH] = {0};
24 _searchenv(
"cygpath.exe",
"PATH", pathbuffer );
25 if( *pathbuffer ==
'\0' ) {
26 sprintf(buf,
"%c:", _getdrive());
29 FILE *pipe = _popen(
"cygpath -m /",
"rt" );
32 fgets(buf,
sizeof(buf), pipe);
33 int len = strlen(buf);
34 while (buf[
len - 1] ==
'\n' || buf[
len - 1] ==
'\r') {
37 if (!feof(pipe)) _pclose(pipe);
38 else fprintf(stderr,
"GetCygwinRootDir() error: Failed to read the pipe to the end.\n");
46 static std::string cygRoot;
47 size_t posCygDrive = path.find(
"/cygdrive/");
48 if (posCygDrive != std::string::npos) {
49 path[posCygDrive] = path[posCygDrive + 10];
50 path[posCygDrive + 1] =
':';
51 path.erase(posCygDrive + 2, 9);
54 size_t posHome = path.find(
"/home/");
55 if (posHome != std::string::npos) {
56 size_t posColumn = path.find(
":");
57 if (posColumn != std::string::npos && posColumn > 0) {
59 if (path[posColumn - 1] >=
'A' && path[posColumn - 1] <=
'Z')
61 if (path[posColumn - 1] >=
'a' && path[posColumn - 1] <=
'z')
64 if (cygRoot.empty()) {
66 size_t len = cygRoot.length();
67 if (cygRoot[
len - 1] ==
'/') {
68 cygRoot.erase(
len - 1);
71 path.insert(posHome, cygRoot);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
static bool FromCygToNativePath(std::string &path)
static const char * GetCygwinRootDir()