//--------------------------------------------------------------------------------------- void Paths::log_paths() { LOMSE_LOG_INFO(to_std_string(wxString::Format("LENMUS_INSTALL_ROOT = [%s]", LENMUS_INSTALL_ROOT ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("SrcRoot = %s", GetSrcRootPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Bin = %s", GetBinPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Xrc = %s", GetXrcPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Temp = %s", GetTemporaryPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Img = %s", GetImagePath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Cursors = %s", GetCursorsPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Sounds = %s", GetSoundsPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Locale = %s", GetLocaleRootPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Scores = %s", GetScoresPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("TestScores = %s", GetTestScoresPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Samples = %s", GetSamplesPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Templates = %s", GetTemplatesPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Config = %s", GetConfigPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Log = %s", GetLogPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Fonts = %s\n", GetFontsPath().wx_str() ))); //DBG: For debugging code for home folder assignment -------------------------- #if (LENMUS_PLATFORM_UNIX == 1) char* homedir = getenv("HOME"); if (homedir == NULL) { struct passwd* pw = getpwuid(getuid()); homedir = pw->pw_dir; } string sHomedir(homedir); wxString sHome = to_wx_string(sHomedir); LOMSE_LOG_INFO(to_std_string(wxString::Format("homedir = %s", sHome.wx_str() ))); wxFileName oLogsHome; oLogsHome.AssignDir( sHome ); LOMSE_LOG_INFO(to_std_string(wxString::Format("initial oLogsHome = %s", oLogsHome.GetFullPath().wx_str() ))); oLogsHome.AppendDir(".config"); oLogsHome.AppendDir("lenmus"); LOMSE_LOG_INFO(to_std_string(wxString::Format("final oLogsHome = %s", oLogsHome.GetFullPath().wx_str() ))); //END_DBG ----------------------------------------------------------------------- #endif }
//--------------------------------------------------------------------------------------- string Paths::dump_paths() { stringstream s; s << "SrcRoot = " << to_std_string(GetSrcRootPath()) << endl; s << "Bin = " << to_std_string(GetBinPath()) << endl; s << "Xrc = " << to_std_string(GetXrcPath()) << endl; s << "Temp = " << to_std_string(GetTemporaryPath()) << endl; s << "Img = " << to_std_string(GetImagePath()) << endl; s << "Cursors = " << to_std_string(GetCursorsPath()) << endl; s << "Sounds = " << to_std_string(GetSoundsPath()) << endl; s << "Locale = " << to_std_string(GetLocaleRootPath()) << endl; s << "Scores = " << to_std_string(GetScoresPath()) << endl; s << "TestScores = " << to_std_string(GetTestScoresPath()) << endl; s << "Samples = " << to_std_string(GetSamplesPath()) << endl; s << "Templates = " << to_std_string(GetTemplatesPath()) << endl; s << "Config = " << to_std_string(GetConfigPath()) << endl; s << "Log = " << to_std_string(GetLogPath()) << endl; s << "Fonts = " << to_std_string(GetFontsPath()) << endl; return s.str(); }
BOOL CTemplateManager::Init() { //Graham 20/10/97 if (Camelot.DeclareSection( _T("NewTemplates"), 10)) { Camelot.DeclarePref( _T("NewTemplates"), _T("DefaultAnimationFile"), &ms_strDefaultAnimationTemplate); Camelot.DeclarePref( _T("NewTemplates"), _T("DefaultDrawingFile"), &ms_strDefaultDrawingTemplate); } if (ms_strDefaultAnimationTemplate==String_256(_T(""))) { String_256 strNameOfAnimationTemplate( _R(IDS_NEWTEMPLATES_DEFAULTANIMATIONFILE) ); String_256 strPathOfTemplate( GetTemplatesPath() ); strPathOfTemplate += strNameOfAnimationTemplate; ms_strDefaultAnimationTemplate=strPathOfTemplate; TRACEUSER( "jlh92", _T("DefAnimTempl = %s\n"), PCTSTR(ms_strDefaultAnimationTemplate) ); } if( ms_strDefaultDrawingTemplate == String_256( _T("") ) || 0 == camStrcmp( ms_strDefaultDrawingTemplate, _T("default.xar") ) ) { ms_strDefaultDrawingTemplate=String_256(_R(IDS_DEFAULTDOCNAME)); PORTNOTETRACE("other","CTemplateManager::Init - remove code to setup paths"); #if !defined(EXCLUDE_FROM_XARALX) //Then assume it's the exe path with \templates\drawing.xar on the end TCHAR Pathname[MAX_PATH]; if(GetModuleFileName(NULL, Pathname, MAX_PATH) == 0) //Should be in the winoil really return FALSE; // Put the path name into a string String_256 strPathOfExe(Pathname); PathName pathPathOfExe(strPathOfExe); strPathOfExe = pathPathOfExe.GetLocation(TRUE); //And add "templates\" to the end String_256 strTemplatesDirectory(_R(IDS_NEWTEMPLATES_RELATIVEPATH)); String_256 strNameOfDrawingTemplate(_R(IDS_DEFAULTDOCNAME)); String_256 strPathOfTemplate=strPathOfExe; strPathOfTemplate+=strTemplatesDirectory; strPathOfTemplate+=strNameOfDrawingTemplate; ms_strDefaultDrawingTemplate=strPathOfTemplate; #endif } // As the preference system is up, declare our preference to it // This is the pathname that the templates should be loaded from and saved to // If blank, the default, then it should use the exe path GetApplication()->DeclareSection(TEXT("Templates"), 2); GetApplication()->DeclarePref(TEXT("Templates"), TEXT("Path"), &m_TemplatesPath); GetApplication()->DeclarePref(TEXT("Templates"), TEXT("LocalPath"), &m_LocalTemplatesPath); //Graham 21/10/97: If it is blank, then we should use the //exe path with "\templates\" on the end if( m_TemplatesPath.IsEmpty() || !SGLibOil::DirExists( m_TemplatesPath ) ) { // Put the path name into a string m_TemplatesPath = CCamApp::GetResourceDirectory(); //And add "templates\" to the end String_256 strRelativePath(_R(IDS_NEWTEMPLATES_RELATIVEPATH)); m_TemplatesPath+=strRelativePath; #if defined(_DEBUG) if( !SGLibOil::DirExists( m_TemplatesPath ) ) m_TemplatesPath = _T("/usr/share/xaralx/Templates/"); #endif } if( m_LocalTemplatesPath.IsEmpty() || !SGLibOil::DirExists( m_LocalTemplatesPath ) ) { wxString strHome( ::wxGetHomeDir() ); m_LocalTemplatesPath = (PCTSTR)strHome; m_LocalTemplatesPath += _T("/.xaralx/templates/"); } TRACEUSER( "jlh92", _T("Using %s as template store\n"), PCTSTR(m_TemplatesPath) ); return TRUE; }