std::string home_dir() { const char *home = getenv("HOME"); if (home) return clean_path(home); struct passwd *pw = getpwuid(getuid()); if (pw && pw->pw_dir) return clean_path(pw->pw_dir); return std::string(); }
int jt_lcfg_listparam(int argc, char **argv) { int rc = 0, i; struct param_opts popt; char pattern[PATH_MAX]; char *path; rc = listparam_cmdline(argc, argv, &popt); if (rc == argc && popt.po_recursive) { rc--; /* we know at least "-R" is a parameter */ argv[rc] = "*"; } else if (rc < 0 || rc >= argc) { return CMD_HELP; } for (i = rc; i < argc; i++) { path = argv[i]; clean_path(path); lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern)); rc = listparam_display(&popt, pattern); if (rc < 0) return rc; } return 0; }
FeTextureContainer::FeTextureContainer( bool is_artwork, const std::string &art_name ) : m_index_offset( 0 ), m_filter_offset( 0 ), m_current_rom_index( -1 ), m_current_filter_index( -1 ), m_art_update_trigger( ToNewSelection ), m_movie( NULL ), m_swf( NULL ), m_movie_status( -1 ), m_video_flags( VF_Normal ) { if ( is_artwork ) { m_type = IsArtwork; m_art_name = art_name.empty() ? FE_DEFAULT_ARTWORK : art_name; } else if ( art_name.find_first_of( "[" ) != std::string::npos ) { m_type = IsDynamic; m_art_name = clean_path( art_name ); } else m_type = IsStatic; }
int jt_lcfg_getparam(int argc, char **argv) { int rc = 0, i; struct param_opts popt; char pattern[PATH_MAX]; char *path; rc = getparam_cmdline(argc, argv, &popt); if (rc < 0 || rc >= argc) return CMD_HELP; for (i = rc, rc = 0; i < argc; i++) { int rc2; path = argv[i]; clean_path(path); lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern)); if (popt.po_only_path) rc2 = listparam_display(&popt, pattern); else rc2 = getparam_display(&popt, pattern); if (rc2 < 0 && rc == 0) rc = rc2; } return rc; }
std::vector<std::string> list_files( const std::string &path, file_filter filter, size_t max_count) { const std::wstring wpath = clean_path(platform::to_windows_path(::to_lower(path))) + L'\\'; auto &hidden_dirs = platform::hidden_dirs(); for (auto &i : hidden_dirs) if (starts_with(wpath, i + L'\\')) return std::vector<std::string>(); std::vector<std::string> result; WIN32_FIND_DATA find_data; HANDLE handle = FindFirstFile((wpath + L'*').c_str(), &find_data); if (handle != INVALID_HANDLE_VALUE) { auto &hidden_names = platform::hidden_names(); auto &hidden_suffixes = platform::hidden_suffixes(); do { if ((find_data.cFileName[0] != L'.') && ((find_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0) && ((find_data.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) == 0)) { std::wstring name = find_data.cFileName, lname = to_lower(name); if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (hidden_names.find(lname) == hidden_names.end()) && (hidden_dirs.find(wpath + lname) == hidden_dirs.end())) { result.emplace_back(from_utf16(name) + '/'); } else if (filter == file_filter::all) { result.emplace_back(from_utf16(name)); } else if ((filter == file_filter::large_files) && (hidden_suffixes.find(suffix_of(lname)) == hidden_suffixes.end())) { struct __stat64 stat; if ((::_wstat64( (wpath + find_data.cFileName).c_str(), &stat) == 0) && (size_t(stat.st_size) >= min_file_size)) { result.emplace_back(from_utf16(name)); } } } } while((result.size() < max_count) && (FindNextFile(handle, &find_data) != 0)); FindClose(handle); } return result; }
// clean messy text coming from the writers void clean() { if( !cleaned ) { clean_name(); clean_log_text(); clean_path(); cleaned = true; } }
int add_file_table(int index, char *file) { char file2[XPP_MAX_NAME]; clean_path(file2, sizeof(file2), file); if (load_table(file2, index) == 0) { plintf("Problem with creating table !!\n"); return (1); } return (0); }
int jt_lcfg_setparam(int argc, char **argv) { int rc = 0, i; struct param_opts popt; char pattern[PATH_MAX]; char *path = NULL, *value = NULL; rc = setparam_cmdline(argc, argv, &popt); if (rc < 0 || rc >= argc) return CMD_HELP; if (popt.po_params2) /* We can't delete parameters that were * set with old conf_param interface */ return jt_lcfg_mgsparam2(argc, argv, &popt); for (i = rc, rc = 0; i < argc; i++) { int rc2; if ((value = strchr(argv[i], '=')) != NULL) { /* format: set_param a=b */ *value = '\0'; value ++; path = argv[i]; if (*value == '\0') break; } else { /* format: set_param a b */ if (path == NULL) { path = argv[i]; continue; } else { value = argv[i]; } } clean_path(path); lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern)); rc2 = setparam_display(&popt, pattern, value); path = NULL; value = NULL; if (rc2 < 0 && rc == 0) rc = rc2; } if (path != NULL && (value == NULL || *value == '\0')) fprintf(stderr, "error: %s: setting %s=: %s\n", jt_cmdname(argv[0]), path, strerror(rc = EINVAL)); return rc; }
void FeTextureContainer::load_from_archive( const char *a, const char *n ) { std::string path, filename = clean_path( n ); if ( filename.empty() ) { clear(); notify_texture_change(); return; } if ( a && ( strlen( a ) > 0 )) path = clean_path( a ); // If it is a relative path we assume it is in the // layout/screensaver/intro directory // else if ( is_relative_path( filename ) ) path = FePresent::script_get_base_path(); bool is_image=false; int i=0; while ( FE_ART_EXTENSIONS[i] ) { if ( tail_compare( filename, FE_ART_EXTENSIONS[i] ) ) { is_image=true; break; } i++; } try_to_load( path, filename, is_image ); notify_texture_change(); }
static bool open_wd(gitdb & db, git_wd & wd, string_view path) { std::string apath = absolute_path(clean_path(path)); path = apath; while (!path.empty()) { std::string nonbare_path = join_paths(path, ".git"); if (file::is_directory(nonbare_path)) { db.open(nonbare_path); wd.open(db, path); return true; } path = path_head(path); } return false; }
const ON_wString Internal_CleanPath(const wchar_t* dirty_path) const { const wchar_t* volume = 0; const wchar_t* path = 0; // Use local path in case drive, dir, file_name_stem or ext are being reused. on_wsplitpath(dirty_path, &volume, &path, nullptr, nullptr); ON_wString clean_path(path); if (clean_path.IsEmpty()) return ON_wString(dirty_path); clean_path.Replace(ON_wString::Backslash, ON_wString::Slash); if (nullptr != volume && volume < path) { ON_wString clean_volume(volume, (int)(path - volume)); return (clean_volume + clean_path); } return clean_path; }
int jt_lcfg_listparam(int argc, char **argv) { int rc = 0, index, i; struct param_opts popt; char *path; memset(&popt, 0, sizeof(popt)); index = listparam_cmdline(argc, argv, &popt); if (index < 0 || index >= argc) return CMD_HELP; for (i = index; i < argc; i++) { int rc2; path = argv[i]; rc2 = clean_path(&popt, path); if (rc2 < 0) { fprintf(stderr, "error: %s: cleaning '%s': %s\n", jt_cmdname(argv[0]), path, strerror(-rc2)); if (rc == 0) rc = rc2; continue; } rc2 = param_display(&popt, path, NULL, LIST_PARAM); if (rc2 < 0) { fprintf(stderr, "error: %s: listing '%s': %s\n", jt_cmdname(argv[0]), path, strerror(-rc2)); if (rc == 0) rc = rc2; continue; } } return rc; }
BOOL cli_resolve_path( const char *mountpt, struct cli_state *rootcli, const char *path, struct cli_state **targetcli, pstring targetpath) { CLIENT_DFS_REFERRAL *refs = NULL; size_t num_refs; uint16 consumed; struct cli_state *cli_ipc; pstring dfs_path, cleanpath, extrapath; int pathlen; fstring server, share; struct cli_state *newcli; pstring newpath; pstring newmount; char *ppath, *temppath = NULL; SMB_STRUCT_STAT sbuf; uint32 attributes; if ( !rootcli || !path || !targetcli ) { return False; } /* Don't do anything if this is not a DFS root. */ if ( !rootcli->dfsroot) { *targetcli = rootcli; pstrcpy( targetpath, path ); return True; } *targetcli = NULL; /* Send a trans2_query_path_info to check for a referral. */ clean_path(path, cleanpath); cli_dfs_make_full_path(rootcli, cleanpath, dfs_path ); if (cli_qpathinfo_basic( rootcli, dfs_path, &sbuf, &attributes ) ) { /* This is an ordinary path, just return it. */ *targetcli = rootcli; pstrcpy( targetpath, path ); goto done; } /* Special case where client asked for a path that does not exist */ if ( cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND) ) { *targetcli = rootcli; pstrcpy( targetpath, path ); goto done; } /* We got an error, check for DFS referral. */ if ( !cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED)) { return False; } /* Check for the referral. */ if ( !(cli_ipc = cli_cm_open( rootcli->desthost, "IPC$", False )) ) { return False; } if ( !cli_dfs_get_referral(cli_ipc, dfs_path, &refs, &num_refs, &consumed) || !num_refs ) { return False; } /* Just store the first referral for now. */ split_dfs_path( refs[0].dfspath, server, share, extrapath ); SAFE_FREE(refs); /* Make sure to recreate the original string including any wildcards. */ cli_dfs_make_full_path( rootcli, path, dfs_path); pathlen = strlen( dfs_path )*2; consumed = MIN(pathlen, consumed ); pstrcpy( targetpath, &dfs_path[consumed/2] ); dfs_path[consumed/2] = '\0'; /* * targetpath is now the unconsumed part of the path. * dfs_path is now the consumed part of the path (in \server\share\path format). */ /* Open the connection to the target server & share */ if ( (*targetcli = cli_cm_open(server, share, False)) == NULL ) { d_printf("Unable to follow dfs referral [\\%s\\%s]\n", server, share ); return False; } if (strlen(extrapath) > 0) { string_append(&temppath, extrapath); string_append(&temppath, targetpath); pstrcpy( targetpath, temppath ); } /* parse out the consumed mount path */ /* trim off the \server\share\ */ ppath = dfs_path; if (*ppath != '\\') { d_printf("cli_resolve_path: dfs_path (%s) not in correct format.\n", dfs_path ); return False; } ppath++; /* Now pointing at start of server name. */ if ((ppath = strchr_m( dfs_path, '\\' )) == NULL) { return False; } ppath++; /* Now pointing at start of share name. */ if ((ppath = strchr_m( ppath+1, '\\' )) == NULL) { return False; } ppath++; /* Now pointing at path component. */ pstr_sprintf( newmount, "%s\\%s", mountpt, ppath ); cli_cm_set_mntpoint( *targetcli, newmount ); /* Check for another dfs referral, note that we are not checking for loops here. */ if ( !strequal( targetpath, "\\" ) && !strequal( targetpath, "/")) { if ( cli_resolve_path( newmount, *targetcli, targetpath, &newcli, newpath ) ) { /* * When cli_resolve_path returns true here it's always * returning the complete path in newpath, so we're done * here. */ *targetcli = newcli; pstrcpy( targetpath, newpath ); return True; } } done: /* If returning True ensure we return a dfs root full path. */ if ( (*targetcli)->dfsroot ) { pstrcpy(dfs_path, targetpath ); cli_dfs_make_full_path( *targetcli, dfs_path, targetpath); } return True; }
void _Log::clean_sound_path(){ clean_path( sound_path ); }
void _Log::clean_image_path(){ clean_path( image_path ); }
void EasySFML::config(){ string typeCompiler; string compiler; string cmake; bool ok = true; // Type de compiler SetColor(DARKGREEN); cout << "# Enter the number in the list to define your compiler." << endl; cout << "# ex: 1" << endl; XMLNode xMainNode=XMLNode::openFileHelper("conf/compiler.xml","PMML"); XMLNode xcompilers=xMainNode.getChildNode("compilers"); int n=xcompilers.nChildNode("compiler"); for (int i = 0; i < n;i++ ){ XMLNode xcompiler =xcompilers.getChildNode("compiler",i); cout << i << " : " << xcompiler.getChildNode("name").getText() << endl; } SetColor(WHITE); cout << "Compiler >> " ; getline(cin, compiler); cout << endl; int i = atoi(compiler.c_str()); if (!(i >= 0 && i < n) || compiler == ""){ ok = false; SetColor(RED); cout << "ERROR: Impossible to choose compiler '" << compiler << "' ."<< endl << endl; SetColor(WHITE); } else{ _compilertype = compiler; } // Compiler if(ok){ XMLNode xcompiler =xcompilers.getChildNode("compiler",i); SetColor(DARKGREEN); cout << "# Enter your compiler path:" << endl; cout << "# ex: " << xcompiler.getChildNode("example").getText() << endl; SetColor(WHITE); cout << "Compiler path >> " ; getline(cin, compiler); cout << endl; string compExe = compiler+xcompiler.getChildNode("bin").getText(); if (!fileExist(compExe)){ ok = false; SetColor(RED); cout << "ERROR: Impossible to find '"<< compExe <<"' ." << endl << endl; SetColor(WHITE); }else{ _compilerpath = compiler; } } _compilerpath = clean_path(_compilerpath); // Cmake if(ok){ SetColor(DARKGREEN); cout << "# Enter your cmake path or ENTER for automatic download:" << endl; cout << "# ex: C:\\Cmake" << endl; SetColor(WHITE); cout << "Cmake path >> " ; getline(cin, cmake); cout << endl; if (cmake == ""){ XMLNode confxml = XMLNode::openFileHelper("conf/cmake.xml","PMML"); XMLNode xcmake = confxml.getChildNode("cmake"); if (!fileExist(xcmake.getChildNode("zip").getText())){ cout << "Download: "<< xcmake.getChildNode("url").getText() << "..." << endl; get_http_data(xcmake.getChildNode("url").getText(),xcmake.getChildNode("zip").getText()); } if (!fileExist(xcmake.getChildNode("src").getText())){ cout << "Unzip: "<< xcmake.getChildNode("zip").getText() << "..." << endl; extract_zip("download/cmake",xcmake.getChildNode("zip").getText()); cmake = xcmake.getChildNode("path").getText(); } cmake = xcmake.getChildNode("path").getText(); cmake = GetPath()+"\\"+cmake+"\\"; // C:/Users/STEVE/Desktop/Projet/C++/download/cmake/cmake-2.8.12.2-win32-x86/bin/cmake.exe } cmake = clean_path(cmake); string cmakeExe = cmake+"bin/cmake.exe"; if (!fileExist(cmakeExe)){ ok = false; SetColor(RED); cout << "ERROR: Impossible to find '"<< cmakeExe <<"' ." << endl << endl; SetColor(WHITE); } else{ _cmakepath = cmake; } } // End if (ok){ SetColor(DARKGREEN); save(); cout << "Configuration is succesfully done." << endl; SetColor(WHITE); } }
void EasySFML::install(){ if (checkConfig()){ SetColor(DARKGREEN); string version; bool ok=true; string finalpath; string command = ""; // Final Path if(ok){ SetColor(DARKGREEN); cout << "# Enter where you want to install sfml:" << endl; cout << "# ex: C:/" << endl; SetColor(WHITE); cout << "SFML path >> " ; getline(cin, finalpath); cout << endl; if (finalpath != ""){ finalpath = clean_path(finalpath); if (!dirExist(finalpath)){ SetColor(RED); cout << "ERROR: Impossible to find folder '" << finalpath << "' ."<< endl << endl; SetColor(WHITE); ok = false; } } else{ SetColor(RED); cout << "ERROR: Impossible to find folder '" << finalpath << "' ."<< endl << endl; SetColor(WHITE); ok = false; } } if (ok){ SetColor(DARKGREEN); cout << "# Enter the sfml version to install." << endl; cout << "# ex: 1" << endl; XMLNode xMainNode=XMLNode::openFileHelper("conf/version.xml","PMML"); XMLNode xversions=xMainNode.getChildNode("versions"); int n=xversions.nChildNode("version"); for (int i = 0; i < n;i++ ){ XMLNode xversion =xversions.getChildNode("version",i); cout << i << " : " << xversion.getChildNode("name").getText() << endl; } SetColor(WHITE); cout << "Version >> " ; getline(cin, version); cout << endl; int i = atoi(version.c_str()); if (!(i >= 0 && i < n) || version == ""){ ok = false; SetColor(RED); cout << "ERROR: Impossible to choose version '" << version << "' ."<< endl << endl; SetColor(WHITE); } else{ // _compilertype = version; int i = atoi(version.c_str()); XMLNode xversion =xversions.getChildNode("version",i); string sfmlPath = xversion.getChildNode("path").getText(); if (!dirExist(sfmlPath)){ cout << "Create new dir: '"<< sfmlPath <<"'" << endl; if (!dirExist("download/versions/")) mkdir("download/versions/"); mkdir(sfmlPath.c_str()); } if (!fileExist(xversion.getChildNode("zip").getText())){ cout << "Download: "<< xversion.getChildNode("url").getText() << "..." << endl; get_http_data(xversion.getChildNode("url").getText(),xversion.getChildNode("zip").getText()); } cout << "Delete: "<< xversion.getChildNode("src").getText() << "..." << endl; command = xversion.getChildNode("src").getText(); command = "rd /s /q \""+command+"\""; system( command.c_str() ); cout << "Unzip: "<< xversion.getChildNode("zip").getText() << "..." << endl; extract_zip(xversion.getChildNode("path").getText(),xversion.getChildNode("zip").getText()); // Compilation string mainpath = GetPath(); string compiler = getCompiler(); string src_sfml = xversion.getChildNode("src").getText(); command = ""; command += "cd " + src_sfml + " && "; command += "set PATH=\""+_compilerpath +"bin/\";%PATH%" + " && "; command += "set PATH=\""+_cmakepath +"bin/\";%PATH%" + " && "; command += "cmake -G \""+compiler+"\" -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=TRUE \"" + mainpath+"/"+src_sfml + "\" && "; command += "mingw32-make &&"; command += "cmake -G \""+compiler+"\" -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=TRUE \"" + mainpath+"/"+src_sfml + "\" && "; command += "mingw32-make && "; command += "cmake -G \""+compiler+"\" -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=FALSE \"" + mainpath+"/"+src_sfml + "\" && "; command += "mingw32-make && "; command += "cmake -G \""+compiler+"\" -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=FALSE \"" + mainpath+"/"+src_sfml + "\" && "; command += "mingw32-make"; //cout << command << endl; int resCMD = system(command.c_str()); if (resCMD == 0 && errno == 0) { cout << "Finalize installation..." << endl; command = xversion.getChildNode("name").getText(); command = "xcopy \""+ mainpath+"/"+src_sfml +"\" \""+finalpath+"/"+command+"\" /s /e /y /i"; cout << command << endl; system(command.c_str()); cout << endl << "Installation complete." << endl; } else{ SetColor(RED); cout << "ERROR: Impossible to cmake or compile." << endl; SetColor(WHITE); } } } } }
BOOL cli_resolve_path( const char *mountpt, struct cli_state *rootcli, const char *path, struct cli_state **targetcli, pstring targetpath ) { CLIENT_DFS_REFERRAL *refs = NULL; size_t num_refs; uint16 consumed; struct cli_state *cli_ipc; pstring fullpath, cleanpath; int pathlen; fstring server, share; struct cli_state *newcli; pstring newpath; pstring newmount; char *ppath; SMB_STRUCT_STAT sbuf; uint32 attributes; *targetcli = NULL; if ( !rootcli || !path || !targetcli ) return False; /* send a trans2_query_path_info to check for a referral */ clean_path( cleanpath, path ); make_full_path( fullpath, rootcli->desthost, rootcli->share, cleanpath ); /* don't bother continuing if this is not a dfs root */ if ( !rootcli->dfsroot || cli_qpathinfo_basic( rootcli, cleanpath, &sbuf, &attributes ) ) { *targetcli = rootcli; pstrcpy( targetpath, path ); return True; } /* we got an error, check for DFS referral */ if ( !cli_dfs_check_error(rootcli) ) return False; /* check for the referral */ if ( !(cli_ipc = cli_cm_open( rootcli->desthost, "IPC$", False )) ) return False; if ( !cli_dfs_get_referral(cli_ipc, fullpath, &refs, &num_refs, &consumed) || !num_refs ) { return False; } /* just store the first referral for now Make sure to recreate the original string including any wildcards */ make_full_path( fullpath, rootcli->desthost, rootcli->share, path ); pathlen = strlen( fullpath )*2; consumed = MIN(pathlen, consumed ); pstrcpy( targetpath, &fullpath[consumed/2] ); split_dfs_path( refs[0].dfspath, server, share ); SAFE_FREE( refs ); /* open the connection to the target path */ if ( (*targetcli = cli_cm_open(server, share, False)) == NULL ) { d_printf("Unable to follow dfs referral [//%s/%s]\n", server, share ); return False; } /* parse out the consumed mount path */ /* trim off the \server\share\ */ fullpath[consumed/2] = '\0'; dos_clean_name( fullpath ); ppath = strchr_m( fullpath, '\\' ); ppath = strchr_m( ppath+1, '\\' ); ppath = strchr_m( ppath+1, '\\' ); ppath++; pstr_sprintf( newmount, "%s\\%s", mountpt, ppath ); cli_cm_set_mntpoint( *targetcli, newmount ); /* check for another dfs referral, note that we are not checking for loops here */ if ( !strequal( targetpath, "\\" ) ) { if ( cli_resolve_path( newmount, *targetcli, targetpath, &newcli, newpath ) ) { *targetcli = newcli; pstrcpy( targetpath, newpath ); } } return True; }
void FeSettings::apply_xml_import( FeImporterContext &c ) { std::string source = c.emulator.get_info( FeEmulatorInfo::Info_source ); if ( source.empty() ) return; std::string base_command = clean_path( c.emulator.get_info( FeEmulatorInfo::Executable ) ); if ( source.compare( "mame" ) == 0 ) { std::cout << " - Obtaining -listxml info..."; FeMameXMLParser mamep( c ); if ( !mamep.parse( base_command ) ) std::cout << "No XML output found, command: " << base_command << " -listxml" << std::endl; } else if ( source.compare( "mess" ) == 0 ) { const std::vector < std::string > &system_names = c.emulator.get_systems(); if ( system_names.empty() ) { std::cout << "Note: No system configured for emulator: " << c.emulator.get_info( FeEmulatorInfo::Name ) << ", unable to obtain -listsoftware info." << std::endl; return; } FeMessXMLParser messp( c ); messp.parse( base_command, system_names ); } else if ( source.compare( "steam" ) == 0 ) { const std::vector<std::string> &paths = c.emulator.get_paths(); const std::vector<std::string> &exts = c.emulator.get_extensions(); if ( paths.empty() || exts.empty() ) return; std::string path = clean_path( paths.front(), true ); const std::string &extension = exts.front(); // A bit mislabelled: the steam import isn't really xml. for ( FeRomInfoListType::iterator itr = c.romlist.begin(); itr != c.romlist.end(); ++itr ) { // We expect appmanifest_* entries in the romname field. Open each of these files and // extract the data we can use in our list const std::string &n = (*itr).get_info( FeRomInfo::Romname ); std::string fname = path + n + extension; // // First, Fix the Romname entry in case we don't find it in the manifest // size_t start_pos = n.find_last_of( "_" ); if ( start_pos != std::string::npos ) (*itr).set_info( FeRomInfo::Romname, n.substr( start_pos + 1 ) ); std::ifstream myfile( fname.c_str() ); int fields_left( 3 ); if ( myfile.is_open() ) { while ( myfile.good() && ( fields_left > 0 ) ) { std::string line, val; size_t pos( 0 ); getline( myfile, line ); token_helper( line, pos, val, FE_WHITESPACE ); if ( icompare( val, "appid" ) == 0 ) { std::string id; token_helper( line, pos, id, FE_WHITESPACE ); (*itr).set_info( FeRomInfo::Romname, id ); fields_left--; } else if ( icompare( val, "name" ) == 0 ) { std::string name; token_helper( line, pos, name, FE_WHITESPACE ); (*itr).set_info( FeRomInfo::Title, name ); fields_left--; } else if ( icompare( val, "installdir" ) == 0 ) { std::string altname; token_helper( line, pos, altname, FE_WHITESPACE ); (*itr).set_info( FeRomInfo::AltRomname, altname ); fields_left--; } } ASSERT( !fields_left ); } else std::cerr << "Error opening file: " << fname << std::endl; } } else if ( source.compare( "thegamesdb.net" ) == 0 ) thegamesdb_scraper( c ); else { std::cout << "Unrecognized import_source setting: " << source << std::endl; } }
/** * Perform a read, write or just a listing of a parameter * * \param[in] popt list,set,get parameter options * \param[in] pattern search filter for the path of the parameter * \param[in] value value to set the parameter if write operation * \param[in] mode what operation to perform with the parameter * * \retval number of bytes written on success. * \retval -errno on error and prints error message. */ static int param_display(struct param_opts *popt, char *pattern, char *value, enum parameter_operation mode) { int dir_count = 0; char **dir_cache; glob_t paths; char *opname = parameter_opname[mode]; int rc, i; rc = cfs_get_param_paths(&paths, "%s", pattern); if (rc != 0) { rc = -errno; if (!popt->po_recursive) { fprintf(stderr, "error: %s: param_path '%s': %s\n", opname, pattern, strerror(errno)); } return rc; } dir_cache = calloc(paths.gl_pathc, sizeof(char *)); if (dir_cache == NULL) { rc = -ENOMEM; fprintf(stderr, "error: %s: allocating '%s' dir_cache[%zd]: %s\n", opname, pattern, paths.gl_pathc, strerror(-rc)); goto out_param; } for (i = 0; i < paths.gl_pathc; i++) { char *param_name = NULL, *tmp; char pathname[PATH_MAX]; struct stat st; int rc2; if (stat(paths.gl_pathv[i], &st) == -1) { fprintf(stderr, "error: %s: stat '%s': %s\n", opname, paths.gl_pathv[i], strerror(errno)); if (rc == 0) rc = -errno; continue; } if (popt->po_only_dir && !S_ISDIR(st.st_mode)) continue; param_name = display_name(paths.gl_pathv[i], &st, popt); if (param_name == NULL) { fprintf(stderr, "error: %s: generating name for '%s': %s\n", opname, paths.gl_pathv[i], strerror(ENOMEM)); if (rc == 0) rc = -ENOMEM; continue; } /** * For the upstream client the parameter files locations * are split between under both /sys/kernel/debug/lustre * and /sys/fs/lustre. The parameter files containing * small amounts of data, less than a page in size, are * located under /sys/fs/lustre and in the case of large * parameter data files, think stats for example, are * located in the debugfs tree. Since the files are split * across two trees the directories are often duplicated * which means these directories are listed twice which * leads to duplicate output to the user. To avoid scanning * a directory twice we have to cache any directory and * check if a search has been requested twice. */ if (S_ISDIR(st.st_mode)) { int j; for (j = 0; j < dir_count; j++) { if (!strcmp(dir_cache[j], param_name)) break; } if (j != dir_count) { free(param_name); param_name = NULL; continue; } dir_cache[dir_count++] = strdup(param_name); } switch (mode) { case GET_PARAM: /* Read the contents of file to stdout */ if (S_ISREG(st.st_mode)) read_param(paths.gl_pathv[i], param_name, popt); break; case SET_PARAM: if (S_ISREG(st.st_mode)) { rc2 = write_param(paths.gl_pathv[i], param_name, popt, value); if (rc2 < 0 && rc == 0) rc = rc2; } break; case LIST_PARAM: if (popt->po_show_path) printf("%s\n", param_name); break; } /* Only directories are searched recursively if * requested by the user */ if (!S_ISDIR(st.st_mode) || !popt->po_recursive) { free(param_name); param_name = NULL; continue; } /* Turn param_name into file path format */ rc2 = clean_path(popt, param_name); if (rc2 < 0) { fprintf(stderr, "error: %s: cleaning '%s': %s\n", opname, param_name, strerror(-rc2)); free(param_name); param_name = NULL; if (rc == 0) rc = rc2; continue; } /* Use param_name to grab subdirectory tree from full path */ tmp = strstr(paths.gl_pathv[i], param_name); /* cleanup paramname now that we are done with it */ free(param_name); param_name = NULL; /* Shouldn't happen but just in case */ if (tmp == NULL) { if (rc == 0) rc = -EINVAL; continue; } rc2 = snprintf(pathname, sizeof(pathname), "%s/*", tmp); if (rc2 < 0) { /* snprintf() should never an error, and if it does * there isn't much point trying to use fprintf() */ continue; } if (rc2 >= sizeof(pathname)) { fprintf(stderr, "error: %s: overflow processing '%s'\n", opname, pathname); if (rc == 0) rc = -EINVAL; continue; } rc2 = param_display(popt, pathname, value, mode); if (rc2 != 0 && rc2 != -ENOENT) { /* errors will be printed by param_display() */ if (rc == 0) rc = rc2; continue; } } for (i = 0; i < dir_count; i++) free(dir_cache[i]); free(dir_cache); out_param: cfs_free_param_data(&paths); return rc; }
int resman_start_watch(struct resman *rman, struct resource *res) { char *path = 0, *last_slash; struct watch_dir *wdir = 0; struct watch_item *witem = 0; /* construct an absolute path for the directory containing this file (must free it afterwards) */ if(!(path = abs_path(res->name))) { return -1; } clean_path(path); /* we need the directory path, so let's find the last slash and cut it there */ if(!(last_slash = strrchr(path, '\\'))) { goto err; } *last_slash = 0; /* check to see if we already have a watch handle for this directory */ if((wdir = rb_find(rman->watchdirs, path))) { wdir->nref++; /* ... if so, increase the refcount */ } else { /* otherwise start a new watch */ if(!(wdir = malloc(sizeof *wdir))) { perror("failed to allocate watchdir"); goto err; } memset(wdir, 0, sizeof *wdir); wdir->nref = 1; /* open the directory we need to watch */ wdir->handle = CreateFile(path, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, 0); if(wdir->handle == INVALID_HANDLE_VALUE) { fprintf(stderr, "failed to watch %s: failed to open directory: %s\n", res->name, path); goto err; } if(!(wdir->buf_unaligned = malloc(RES_BUF_SIZE + 3))) { fprintf(stderr, "failed to allocate watch result buffer (%d bytes)\n", RES_BUF_SIZE); goto err; } wdir->buf = (char*)(((intptr_t)wdir->buf_unaligned + 3) & ~(intptr_t)0x3); memset(&wdir->over, 0, sizeof wdir->over); wdir->over.hEvent = CreateEvent(0, TRUE, FALSE, 0); if(!ReadDirectoryChangesW(wdir->handle, wdir->buf, RES_BUF_SIZE, 0, FILE_NOTIFY_CHANGE_LAST_WRITE, 0, &wdir->over, 0)) { fprintf(stderr, "failed to start async dirchange monitoring\n"); goto err; } wdir->watch_path = path; rb_insert(rman->watchdirs, path, wdir); rb_insert(rman->wdirbyev, wdir->over.hEvent, wdir); rman->watch_handles = dynarr_push(rman->watch_handles, &wdir->over.hEvent); } /* add a new watch item to this watch dir */ if(!(witem = malloc(sizeof *witem))) { perror("failed to allocate watch item"); goto err; } witem->next = wdir->items; wdir->items = witem; witem->res = res; res->watch_path = path; return 0; err: free(path); if(wdir) { if(wdir->handle && wdir->handle != INVALID_HANDLE_VALUE) { CloseHandle(wdir->handle); } free(wdir->buf_unaligned); if(wdir->over.hEvent && wdir->over.hEvent != INVALID_HANDLE_VALUE) { CloseHandle(wdir->over.hEvent); } } return -1; }
int jt_lcfg_setparam(int argc, char **argv) { int rc = 0, index, i; struct param_opts popt; char *path = NULL, *value = NULL; memset(&popt, 0, sizeof(popt)); index = setparam_cmdline(argc, argv, &popt); if (index < 0 || index >= argc) return CMD_HELP; if (popt.po_params2) /* We can't delete parameters that were * set with old conf_param interface */ return jt_lcfg_mgsparam2(argc, argv, &popt); for (i = index; i < argc; i++) { int rc2; path = NULL; value = strchr(argv[i], '='); if (value != NULL) { /* format: set_param a=b */ *value = '\0'; value++; path = argv[i]; if (*value == '\0') { fprintf(stderr, "error: %s: setting %s: no value\n", jt_cmdname(argv[0]), path); if (rc == 0) rc = -EINVAL; continue; } } else { /* format: set_param a b */ path = argv[i]; i++; if (i >= argc) { fprintf(stderr, "error: %s: setting %s: no value\n", jt_cmdname(argv[0]), path); if (rc == 0) rc = -EINVAL; break; } else { value = argv[i]; } } rc2 = clean_path(&popt, path); if (rc2 < 0) { fprintf(stderr, "error: %s: cleaning %s: %s\n", jt_cmdname(argv[0]), path, strerror(-rc2)); if (rc == 0) rc = rc2; continue; } /* A value containing '=' is indicative of user error, e.g.: * lctl set_param param1 param2=value2 * lctl set_param param1=param2=value2 */ if (strchr(value, '=') != NULL) fprintf(stderr, "warning: %s: value '%s' contains '='\n", jt_cmdname(argv[0]), value); rc2 = param_display(&popt, path, value, SET_PARAM); if (rc == 0) rc = rc2; } return rc; }
NTSTATUS cli_resolve_path(TALLOC_CTX *ctx, const char *mountpt, const struct user_auth_info *dfs_auth_info, struct cli_state *rootcli, const char *path, struct cli_state **targetcli, char **pp_targetpath) { struct client_dfs_referral *refs = NULL; size_t num_refs = 0; size_t consumed = 0; struct cli_state *cli_ipc = NULL; char *dfs_path = NULL; char *cleanpath = NULL; char *extrapath = NULL; int pathlen; char *server = NULL; char *share = NULL; struct cli_state *newcli = NULL; char *newpath = NULL; char *newmount = NULL; char *ppath = NULL; SMB_STRUCT_STAT sbuf; uint32 attributes; NTSTATUS status; if ( !rootcli || !path || !targetcli ) { return NT_STATUS_INVALID_PARAMETER; } /* Don't do anything if this is not a DFS root. */ if ( !rootcli->dfsroot) { *targetcli = rootcli; *pp_targetpath = talloc_strdup(ctx, path); if (!*pp_targetpath) { return NT_STATUS_NO_MEMORY; } return NT_STATUS_OK; } *targetcli = NULL; /* Send a trans2_query_path_info to check for a referral. */ cleanpath = clean_path(ctx, path); if (!cleanpath) { return NT_STATUS_NO_MEMORY; } dfs_path = cli_dfs_make_full_path(ctx, rootcli, cleanpath); if (!dfs_path) { return NT_STATUS_NO_MEMORY; } status = cli_qpathinfo_basic( rootcli, dfs_path, &sbuf, &attributes); if (NT_STATUS_IS_OK(status)) { /* This is an ordinary path, just return it. */ *targetcli = rootcli; *pp_targetpath = talloc_strdup(ctx, path); if (!*pp_targetpath) { return NT_STATUS_NO_MEMORY; } goto done; } /* Special case where client asked for a path that does not exist */ if (cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) { *targetcli = rootcli; *pp_targetpath = talloc_strdup(ctx, path); if (!*pp_targetpath) { return NT_STATUS_NO_MEMORY; } goto done; } /* We got an error, check for DFS referral. */ if (!cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED, status)) { return status; } /* Check for the referral. */ status = cli_cm_open(ctx, rootcli, cli_state_remote_name(rootcli), "IPC$", dfs_auth_info, false, cli_state_encryption_on(rootcli), cli_state_protocol(rootcli), 0, 0x20, &cli_ipc); if (!NT_STATUS_IS_OK(status)) { return status; } status = cli_dfs_get_referral(ctx, cli_ipc, dfs_path, &refs, &num_refs, &consumed); if (!NT_STATUS_IS_OK(status) || !num_refs) { return status; } /* Just store the first referral for now. */ if (!refs[0].dfspath) { return NT_STATUS_NOT_FOUND; } if (!split_dfs_path(ctx, refs[0].dfspath, &server, &share, &extrapath)) { return NT_STATUS_NOT_FOUND; } /* Make sure to recreate the original string including any wildcards. */ dfs_path = cli_dfs_make_full_path(ctx, rootcli, path); if (!dfs_path) { return NT_STATUS_NO_MEMORY; } pathlen = strlen(dfs_path); consumed = MIN(pathlen, consumed); *pp_targetpath = talloc_strdup(ctx, &dfs_path[consumed]); if (!*pp_targetpath) { return NT_STATUS_NO_MEMORY; } dfs_path[consumed] = '\0'; /* * *pp_targetpath is now the unconsumed part of the path. * dfs_path is now the consumed part of the path * (in \server\share\path format). */ /* Open the connection to the target server & share */ status = cli_cm_open(ctx, rootcli, server, share, dfs_auth_info, false, cli_state_encryption_on(rootcli), cli_state_protocol(rootcli), 0, 0x20, targetcli); if (!NT_STATUS_IS_OK(status)) { d_printf("Unable to follow dfs referral [\\%s\\%s]\n", server, share ); return status; } if (extrapath && strlen(extrapath) > 0) { /* EMC Celerra NAS version 5.6.50 (at least) doesn't appear to */ /* put the trailing \ on the path, so to be save we put one in if needed */ if (extrapath[strlen(extrapath)-1] != '\\' && **pp_targetpath != '\\') { *pp_targetpath = talloc_asprintf(ctx, "%s\\%s", extrapath, *pp_targetpath); } else { *pp_targetpath = talloc_asprintf(ctx, "%s%s", extrapath, *pp_targetpath); } if (!*pp_targetpath) { return NT_STATUS_NO_MEMORY; } } /* parse out the consumed mount path */ /* trim off the \server\share\ */ ppath = dfs_path; if (*ppath != '\\') { d_printf("cli_resolve_path: " "dfs_path (%s) not in correct format.\n", dfs_path ); return NT_STATUS_NOT_FOUND; } ppath++; /* Now pointing at start of server name. */ if ((ppath = strchr_m( dfs_path, '\\' )) == NULL) { return NT_STATUS_NOT_FOUND; } ppath++; /* Now pointing at start of share name. */ if ((ppath = strchr_m( ppath+1, '\\' )) == NULL) { return NT_STATUS_NOT_FOUND; } ppath++; /* Now pointing at path component. */ newmount = talloc_asprintf(ctx, "%s\\%s", mountpt, ppath ); if (!newmount) { return NT_STATUS_NOT_FOUND; } cli_set_mntpoint(*targetcli, newmount); /* Check for another dfs referral, note that we are not checking for loops here. */ if (!strequal(*pp_targetpath, "\\") && !strequal(*pp_targetpath, "/")) { status = cli_resolve_path(ctx, newmount, dfs_auth_info, *targetcli, *pp_targetpath, &newcli, &newpath); if (NT_STATUS_IS_OK(status)) { /* * When cli_resolve_path returns true here it's always * returning the complete path in newpath, so we're done * here. */ *targetcli = newcli; *pp_targetpath = newpath; return status; } } done: /* If returning true ensure we return a dfs root full path. */ if ((*targetcli)->dfsroot) { dfs_path = talloc_strdup(ctx, *pp_targetpath); if (!dfs_path) { return NT_STATUS_NO_MEMORY; } *pp_targetpath = cli_dfs_make_full_path(ctx, *targetcli, dfs_path); if (*pp_targetpath == NULL) { return NT_STATUS_NO_MEMORY; } } return NT_STATUS_OK; }
static const std::unordered_set<std::wstring> & hidden_dirs() { static std::unordered_set<std::wstring> hidden_dirs; static std::once_flag flag; std::call_once(flag, [] { const wchar_t *dir = _wgetenv(L"SystemDrive"); if (dir == nullptr) dir = L"c:"; hidden_dirs.insert(to_lower(clean_path(dir) + L"\\program files")); hidden_dirs.insert(to_lower(clean_path(dir) + L"\\program files (x86)")); hidden_dirs.insert(to_lower(clean_path(dir) + L"\\windows")); hidden_dirs.insert(to_lower(clean_path(dir) + L"\\temp")); hidden_dirs.insert(to_lower(clean_path(dir) + L"\\recycler")); dir = _wgetenv(L"ProgramFiles"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); dir = _wgetenv(L"ProgramFiles(x86)"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); dir = _wgetenv(L"SystemRoot"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); dir = _wgetenv(L"TEMP"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); dir = _wgetenv(L"TMP"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); dir = _wgetenv(L"windir"); if (dir) hidden_dirs.insert(to_lower(clean_path(dir))); wchar_t temp_path[MAX_PATH]; if (GetTempPath(sizeof(temp_path) / sizeof(*temp_path), temp_path) > 0) hidden_dirs.insert(to_lower(clean_path(temp_path))); }); return hidden_dirs; }
bool FeEmulatorEditMenu::on_option_select( FeConfigContext &ctx, FeBaseConfigMenu *& submenu ) { FeMenuOpt &o = ctx.curr_opt(); if ( !m_emulator ) return true; switch ( o.opaque ) { case 1: // Edit artwork m_art_menu.set_art( m_emulator, o.setting ); submenu = &m_art_menu; break; case 2: // Add new artwork m_art_menu.set_art( m_emulator, "" ); submenu = &m_art_menu; break; case 3: // Generate Romlist { // Make sure m_emulator is set with all the configured info // for ( int i=0; i < FeEmulatorInfo::LAST_INDEX; i++ ) m_emulator->set_info( (FeEmulatorInfo::Index)i, ctx.opt_list[i].get_value() ); // Do some checks and confirmation before launching the Generator // std::vector<std::string> paths = m_emulator->get_paths(); for ( std::vector<std::string>::const_iterator itr = paths.begin(); itr != paths.end(); ++itr ) { std::string rom_path = clean_path( *itr ); if ( !directory_exists( rom_path ) ) { if ( ctx.confirm_dialog( "Rom path '$1' not found, proceed anyways?", rom_path ) == false ) return false; else break; // only bug the user once if there are multiple paths configured } } std::string emu_name = m_emulator->get_info( FeEmulatorInfo::Name ); if ( m_romlist_exists ) { if ( ctx.confirm_dialog( "Overwrite existing '$1' list?", emu_name ) == false ) return false; } FePresent *fep = FePresent::script_get_fep(); if ( fep ) fep->set_video_play_state( false ); ctx.fe_settings.build_romlist( emu_name, gen_ui_update, &ctx, ctx.help_msg ); if ( fep ) fep->set_video_play_state( fep->get_video_toggle() ); // // If we don't have a display configured for this romlist, // configure one now // if ( !ctx.fe_settings.check_romlist_configured( emu_name ) ) { FeDisplayInfo *new_disp = ctx.fe_settings.create_display( emu_name ); new_disp->set_info( FeDisplayInfo::Romlist, emu_name ); } ctx.save_req = true; m_parent_save = true; } break; case 4: // Scrape Artwork { FePresent *fep = FePresent::script_get_fep(); if ( fep ) fep->set_video_play_state( false ); std::string emu_name = m_emulator->get_info( FeEmulatorInfo::Name ); ctx.fe_settings.scrape_artwork( emu_name, scrape_ui_update, &ctx, ctx.help_msg ); if ( fep ) fep->set_video_play_state( fep->get_video_toggle() ); } break; case 5: // Delete this Emulator { std::string name = m_emulator->get_info(FeEmulatorInfo::Name); if ( ctx.confirm_dialog( "Delete emulator '$1'?", name ) == false ) return false; ctx.fe_settings.delete_emulator( m_emulator->get_info(FeEmulatorInfo::Name) ); } break; case 100: // Hotkey input { std::string res; FeInputMap::Command conflict( FeInputMap::LAST_COMMAND ); ctx.input_map_dialog( "Press Exit Hotkey", res, conflict ); bool save=false; if ( o.get_value().compare( res ) != 0 ) save = true; else { if ( ctx.confirm_dialog( "Clear Exit Hotkey?", res )) { res.clear(); save = true; } } if ( save ) { o.set_value( res ); ctx.save_req = true; } } break; default: break; } return true; }
FeShader *FePresent::add_shader( FeShader::Type type, const char *shader1, const char *shader2 ) { std::string path; m_feSettings->get_path( FeSettings::Current, path ); std::string s1 = clean_path( shader1 ); m_scriptShaders.push_back( new FeShader() ); FeShader *sh = m_scriptShaders.back(); if ( !is_relative_path( s1 ) ) path.clear(); switch ( type ) { case FeShader::VertexAndFragment: if ( is_supported_archive( path ) ) { // // Known Issue: We don't properly handle the // situation where one shader is specified as a // relative path and is in a zip, while the other // is specified as an absolute path. If the first // is in a zip, the second is assumed to be in the // same zip as well. // FeZipStream zs1( path ); zs1.open( shader1 ); FeZipStream zs2( path ); zs2.open( shader2 ); sh->load( zs1, zs2 ); } else { std::string path2 = path; std::string s2 = clean_path( shader2 ); if ( !is_relative_path( s2 ) ) path2.clear(); sh->load( path + s1, path2 + s2 ); } break; case FeShader::Vertex: case FeShader::Fragment: if ( is_supported_archive( path ) ) { FeZipStream zs( path ); zs.open( shader1 ); sh->load( zs, type ); } else { sh->load( path + s1, type ); } break; case FeShader::Empty: default: break; } return sh; }
void AppDelegate::preload_sounds() { #ifdef _WIN32 CCLOG("on windows, skipping audio preload"); #else CocosDenshion::SimpleAudioEngine* cache = CocosDenshion::SimpleAudioEngine::getInstance(); CCLOG("start loading audio"); cache->preloadEffect(clean_path("sounds\\old\\Swoosh.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\barrel.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\beep.mp3").c_str()); // cache->preloadEffect(clean_path("sounds\\old\\block.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\brick_hit.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\brick_scrape.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\cheering.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\coin.mp3").c_str()); //cache->preloadEffect(clean_path("sounds\\old\\ding.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\doom_rocket.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\dsnoway.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\glassbreak.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\ice_freeze.mp3").c_str()); //cache->preloadEffect(clean_path("sounds\\old\\lighter.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\radio_wave.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\real_punch.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\shield_die.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\shield_disable.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\shield_hit.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\shotgun.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\shotgun_reload.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\suicide_bomber.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\wall_destroy.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\barrel\\C_barrel_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\block\\C_block+1.mp3").c_str()); // cache->preloadEffect(clean_path("sounds\\new\\block\\C_block+2.mp3").c_str()); // cache->preloadEffect(clean_path("sounds\\new\\block\\C_block_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\charged\\C_charged_1.mp3").c_str()); //cache->preloadEffect(clean_path("sounds\\new\\cheering\\C_cheering_11.mp3").c_str()); //TODO Find a use for this //cache->preloadEffect(clean_path("sounds\\new\\cheering\\C_cheering_12.mp3").c_str()); //TODO Find a use for this cache->preloadEffect(clean_path("sounds\\new\\cheering\\C_cheering_13.mp3").c_str()); //cache->preloadEffect(clean_path("sounds\\new\\coin\\C_coin_1.mp3").c_str()); //cache->preloadEffect(clean_path("sounds\\new\\coin\\C_coin_2.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\doom_rocket\\C_grenade_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\doom_rocket\\C_rocket_big_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\doom_rocket\\C_rocket_small_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_11.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_12.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_13.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_14.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_15.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_16.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_17.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Grunt_18.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_11.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_12.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_13.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_14.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_15.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_16.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_17.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\dsnoway\\C_Hit_18.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\extra\\C_explosion_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\glassbreak\\C_glassbreak_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\ice_freeze\\C_ice_freeze+.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\ice_freeze\\C_ice_freeze_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\lighter\\C_lighter_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\radio_wave\\C_radio_wave_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\radio_wave\\C_radio_wave_2.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\radio_wave\\C_radio_wave_3.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_combo_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch+1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch+2.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch+3.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_11.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_21.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_22.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_23.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_24.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_25.mp3").c_str()); // cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_26.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_27.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_28.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\real_punch\\C_punch_31.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\shotgun\\C_shotgun_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\shotgun_reload\\C_shotgun_reload_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\suicide_bomber\\C_rocket_big+1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\suicide_bomber\\C_rocket_small+2.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_1.wav").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_11.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_12.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_13.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_14.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_15.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_21.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_22.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_23.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_24.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_25.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_26.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\Swoosh\\C_Swoosh_27.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\new\\woop\\C_woop_1.mp3").c_str()); cache->preloadEffect(clean_path("sounds\\old\\woop.mp3").c_str()); CCLOG("done loading audio"); #endif };