- if (!FileExists(rootDirectory)) // .bbtk not found
- {
- system(makeDir); // create .bbtk
- }
-
- // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
- CreateConfigXML( rootDirectory );// create .bbtk
- return;
- }
-
- sprintf(copyFile,"copy %s\\bbtk_config.xml.tmp \"%s\"\\bbtk_config.xml ",bbtk_path,rootDirectory );
-
- int attribs = GetFileAttributes (rootDirectory);
- bbtkMessage("Config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl);
- if ( attribs != 0xFFFFFFFF){
- if ((attribs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) /// \TODO : check !
+ FILE *fp;
+ char configXml[250];
+ sprintf (configXml , "%s/bbtk_config.xml", rootDirectory);
+ bbtkDebugMessage("config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
+ fp = fopen (configXml, "w");
+ fprintf(fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
+ fprintf(fp, "<config>\n");
+ fprintf(fp, " <bbs_path> </bbs_path>\n");
+ fprintf(fp, " <package_path> </package_path>\n");
+ fprintf(fp, "</config>\n");
+ fclose(fp);
+ }
+ //=========================================================================
+
+
+
+
+ //=========================================================================
+ void ConfigurationFile::InstallPath ()
+ {
+
+ /*--------------------------------------------------
+ New policy for bbtk_config.xml :
+
+ if bbtk_config.xml found in current directory (user is an aware user!)
+ use it!
+
+ else if bbtk_config.xml found in HOME/.bbtk (user already worked with it)
+ use it!
+
+ else if bbtk_config.xml.tmp found in /usr/local/bin or c:\\Program Files\\BBTK\\bin
+ copy it as .bbtk/bbtk_config.xml
+
+ else (nothing installed)
+ create a minimum version in HOME/.bbtk
+ ----------------------------------------------------*/
+
+
+ // -----------------------------------------------------------------
+#if defined(WIN32)
+
+ // installed bbtk_path
+ char bbtk_path[100];
+ strcpy(bbtk_path, "\"c:\\Program Files\\BBTK\\bin\"");
+ char bbtk_path2[100];
+ strcpy(bbtk_path2, "c:\\Program Files\\BBTK\\bin");
+
+ // rootDirectory
+ char rootDirectory[200];
+ sprintf(rootDirectory, "%s\\.bbtk",getenv("USERPROFILE"));
+ // std::cout << "[" << rootDirectory << "]" << std::endl;
+
+ // configPath
+ char configPath[200];
+ sprintf(configPath, "%s\\bbtk_config.xml",rootDirectory);
+
+ // makeDir
+ char makeDir[250];
+ sprintf( makeDir, "mkdir \"%s\" ", rootDirectory);
+
+ // configXmlTmp
+ char configXmlTmp[250];
+ sprintf(configXmlTmp, "%s\\bbtk_config.xml.tmp", bbtk_path2);
+
+ // copyFile
+ char copyFile[250];
+
+ if (!Utilities::FileExists(configXmlTmp)) // bbtk_config.xml.tmp not found
+ {
+ // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
+ CreateConfigXML( rootDirectory );// create .bbtk
+ return;
+ }
+
+ sprintf(copyFile,"copy %s\\bbtk_config.xml.tmp \"%s\"\\bbtk_config.xml ",bbtk_path,rootDirectory );
+
+ WCHAR rootDirectory2[200];
+ MultiByteToWideChar( 0,0, rootDirectory, 200, rootDirectory2, 6);
+ LPCWSTR rootDirectory3 = rootDirectory2;
+ int attribs = GetFileAttributes (rootDirectory3);
+// int attribs = GetFileAttributes (rootDirectory3);
+
+
+ bbtkMessage("config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl);
+ if ( attribs != 0xFFFFFFFF)