bool ThorScriptParserStage::parseOptions(po::variables_map& vm)
{
	debug_parser = (vm.count("debug-parser") > 0);
	debug_ast = (vm.count("debug-parser-ast") > 0);
	debug_ast_with_loc = (vm.count("debug-parser-ast-with-loc") > 0);
	use_relative_path = (vm.count("use-relative-path") > 0);
	dump_graphviz = (vm.count("dump-graphviz") > 0);
    if(vm.count("dump-graphviz-dir") > 0)
    {
        dump_graphviz_dir = vm["dump-graphviz-dir"].as<std::string>();
    }
    if(vm.count("prepand-package"))
    {
        prepand_package = vm["prepand-package"].as<std::string>();
    }

	if(vm.count("root-dir") == 0)
		root_dir = boost::filesystem::current_path() / "src";
	else
	{
		root_dir = vm["root-dir"].as<std::string>();
		root_dir = normalize_path(root_dir);
	}

	if(vm.count("input") == 0)
		return false;

	inputs = vm["input"].as<std::vector<std::string>>();
	return true;
}
예제 #2
0
파일: filesystem.c 프로젝트: BigEd/pyldin
static int wrap_fs_rename(struct _reent *r, char *oldpath, char *newpath)
{
#if 0
    char tmpath[256];
    if ((oldpath[0] != '/') && (oldpath[0] != '\\'))
	snprintf(tmpath, 256, "%s/%s", current_path, oldpath);
    else
	strcpy(tmpath, oldpath);
    normalize_path(tmpath);

    char tmpath1[256];
    if ((newpath[0] != '/') && (newpath[0] != '\\'))
	snprintf(tmpath1, 256, "%s/%s", current_path, newpath);
    else
	strcpy(tmpath1, newpath);
    normalize_path(tmpath1);

    FF_ERROR error = FF_Move(pIoman, tmpath, tmpath1);

    if (!error)
	return 0;
#endif

    r->_errno = EACCES;
    return -1;
}
예제 #3
0
파일: help.c 프로젝트: Shea690901/gurbalib
void main( string arg ) {
  string file;
  string *tmp;
  string *lines;
  int i;
  int where;

  if ( !arg || arg == "" ) {
    arg = "help";
  }

  arg = lowercase(arg);
  
  file = normalize_path( arg, "/help/" );
  
  if( file_exists( file ) < 1 ) {
    if( query_wizard( this_player() ) ) {
      file = normalize_path( arg, "/help/wiz/");
      if( file_exists(file) < 1 ) {
	write( capitalize(arg) + ": Unknown help topic." );
	LOG_D->write_log("help", capitalize(this_player()->query_name()) + " on " + ctime(time()) + ": " + arg + "\n");
	return;
      }
    } else {
      write( capitalize(arg) + ": Unknown help topic." );
      write_file("/logs/help", capitalize(this_player()->query_name()) + " on " + ctime(time()) + ": " + arg + "\n");
      return;
    }
  }
  
  tmp = explode( read_file( file ), "\n" );
  lines = ({ });
예제 #4
0
sint32_t vfs_rename( const char *oldname, const char *newname )
{
    vfs_fs_fns *fs_fns;
    const char *normoldname = normalize_path( oldname );
    const char *normnewname = normalize_path( newname );
    char *oldoutname, *newoutname;

#ifdef BUILD_SPIFFS
    if (myspiffs_realm( normoldname, &oldoutname, FALSE )) {
        if (fs_fns = myspiffs_realm( normnewname, &newoutname, FALSE )) {
            return fs_fns->rename( oldoutname, newoutname );
        }
    }
#endif

#ifdef BUILD_FATFS
    if (myfatfs_realm( normoldname, &oldoutname, FALSE )) {
        if (fs_fns = myfatfs_realm( normnewname, &newoutname, FALSE )) {
            sint32_t r = fs_fns->rename( oldoutname, newoutname );
            c_free( oldoutname );
            c_free( newoutname );
            return r;
        }
        c_free( oldoutname );
    }
#endif

    return -1;
}
예제 #5
0
bool FileSystem::rename(const std::string &oldname, const std::string &newname)
{
  std::string oldpath(normalize_path(oldname));
  std::string newpath(normalize_path(newname));

  if (std::rename(oldpath.c_str(), newpath.c_str()) != 0) return false;
  return true;
}
예제 #6
0
파일: system.cpp 프로젝트: fsantanna/pingus
std::string
System::realpath(const std::string& pathname)
{
  std::string fullpath;

#ifdef WIN32
  std::string drive;
  if (pathname.size() > 2 && pathname[1] == ':' && pathname[2] == '/')
  {
    // absolute path on Win32
    drive = pathname.substr(0, 2);
    fullpath = pathname.substr(2);
  }
#else
  if (pathname.size() > 0 && pathname[0] == '/')
  {
    // absolute path on Linux
    fullpath = pathname;
  }
#endif
  else
  {
    // relative path
    char* cwd = getcwd(NULL, 0);
    if (!cwd)
    {
      log_error("System::realpath: Error: couldn't getcwd()");
      return pathname;
    }
    else
    {
#ifdef WIN32
      // unify directory separator to '/'
      for (char *p = cwd; *p; ++p)
      {
        if (*p == '\\')
          *p = '/';
      }
      drive.assign(cwd, 2);
      fullpath = Pathname::join(std::string(cwd+2), pathname);
#else
      fullpath = Pathname::join(std::string(cwd), pathname);
#endif
      free(cwd);
    }
  }

#ifdef WIN32
  return drive + normalize_path(fullpath);
#else
  return normalize_path(fullpath);
#endif
}
예제 #7
0
static std::string make_full_path(const char *path)
{
    //RHO_LOG("make_full_path: %s", path);
    if (path == NULL || *path == '\0')
        return "";

    if (*path == '/')
        return normalize_path(path);

    //std::string fpath = rho_root_path() + "/" + path;
    std::string fpath = rho_cur_path() + "/" + path;

    return normalize_path(fpath);
}
예제 #8
0
/*!
 * \brief An strcmp() for paths
 *
 * This function will normalize \a path1 and \a path2 before they are passed to
 * std::string::compare(). This way, extra slashes, '.', '..', etc. are handled
 * before the string comparison is performed.
 *
 * \note This function does not traverse the filesystem at all. It works purely
 *       on the given path strings.
 *
 * \return An integer less than, equal to, or greater than zero if \a path1 is
 *         found, respectively, to be less than, equal to, or greater than
 *         \a path2 lexicographically.
 */
int path_compare(const std::string &path1, const std::string &path2)
{
    if (path1.empty() || path2.empty()) {
        return false;
    }

    std::vector<std::string> path1_pieces(path_split(path1));
    std::vector<std::string> path2_pieces(path_split(path2));

    normalize_path(path1_pieces);
    normalize_path(path2_pieces);

    return path_join(path1_pieces).compare(path_join(path2_pieces));
}
static void word_hash_config( StringList *sl, WORD_HASH_TABLE *table_ptr )
{
    int i;

    if (sl->n < 2)
        progerr("%s: requires at least one value", sl->word[0]);


    if (lstrstr(sl->word[1], "SwishDefault"))
        progwarn("SwishDefault is obsolete. See the CHANGES file.");


    if (lstrstr(sl->word[1], "File:"))
    {
        if (sl->n == 3)
        {
            normalize_path( sl->word[2] );
            readwordsfile(table_ptr, sl->word[2]);
            return;
        }
        else
            progerr("IgnoreWords File: requires path");
    }


    for (i = 1; i < sl->n; i++)
        add_word_to_hash_table( table_ptr, strtolower(sl->word[i]), HASHSIZE);
}
예제 #10
0
// Turns path into a full path:
//  - if not absolute, prepends gamedir
//  - calls realpath() to collapse ".." and such
//  - calls normalize_pathname() to fix backslashes, etc
//
// Much like realpath, buffer pointed to by fullpath is assumed to be 
// able to store a string of PATH_MAX length.
void sup_gamedir_path(const char *path, char *fullpath)
{
	char buf[PATH_MAX];
	
	// Build pathname from filename, plus gamedir if relative path.
	if(is_absolute_path(path))
		STRNCPY(buf, path, sizeof(buf));
	else
	{
		const char *plugpath = gpMetaUtilFuncs->pfnGetPluginPath(PLID);
		STRNCPY(buf, plugpath, sizeof(buf));
		for(int i = strlen(buf); i != -1; i--)
		{
			if(buf[i] == '/')
			{
				buf[i + 1] = '\0';
				break;
			}
		}
		strncat(buf, path, sizeof(buf));
	}

	normalize_path(buf);
	STRNCPY(fullpath, buf, sizeof(buf));
}
예제 #11
0
FileSystem::namelist_type FileSystem::get_list(const std::string &dir_name,
                                               int type_flag)
{
  namelist_type  result;
  std::string    path(normalize_path(dir_name));
  DIR           *dp;
  struct dirent *entry;
  struct stat    statbuf;
  
  // Scan the directory.
  if ((dp = opendir(path.c_str())) != NULL) {
    while ((entry = readdir(dp)) != NULL) {

      // If the current name is dot or dotdot, ignore it.
      if (strcmp(entry->d_name, "." ) == 0 ||
          strcmp(entry->d_name, "..") == 0) continue;

      // If the current name is that of a file, add it to the result.
      std::string full_name(path + "/" + entry->d_name);
      if (stat(full_name.c_str(), &statbuf) != -1) {
        if (type_flag == 0 && S_ISREG(statbuf.st_mode)) {
          result.push_back(entry->d_name);
        }
        if (type_flag == 1 && S_ISDIR(statbuf.st_mode)) {
          result.push_back(entry->d_name);
        }
      }
    }
    closedir(dp);
  }

  return result;
}
예제 #12
0
bool FileSystem::rmdir(const std::string &name)
{
  std::string path(normalize_path(name));

  if (::rmdir(path.c_str()) != 0) return false;
  return true;
}
예제 #13
0
int FileSystem::open(const std::string &name, mode_type mode)
{
  int handle;
  std::string path(normalize_path(name));

  std::ios::openmode file_mode = std::ios::in;
  if (mode == Write) file_mode = std::ios::out;
  if (mode == Append) file_mode = std::ios::out|std::ios::app;

  std::fstream *file = new std::fstream(path.c_str(), file_mode);
  if (!*file) {
    delete file;
    return -1;
  }

  // Look for a free slot in the file table.
  std::fstream *search_value = NULL;
  filetable_type::iterator p =
    std::find(file_table.begin(), file_table.end(), search_value);
  if (p != file_table.end()) {
    *p = file;
    // Handle might not be representable as int.
    handle = p - file_table.begin();
  }
  else {
    file_table.push_back(file);  // Assume this succeeds.
    // Handle might not be representable as int.
    handle = file_table.size() - 1;
  }

  return handle;
}
예제 #14
0
void print_binary_file_matches(const char* path) {
    path = normalize_path(path);
    const char *buf = fix_path_slashes(path);
    print_file_separator();
    fprintf(out_fd, "Binary file %s matches.\n", buf);
    free((void*)buf);
}
예제 #15
0
sint32_t vfs_errno( const char *name )
{
    vfs_fs_fns *fs_fns;
    char *outname;

    if (!name) name = "";  // current drive

    const char *normname = normalize_path( name );

#ifdef BUILD_SPIFFS
    if (fs_fns = myspiffs_realm( normname, &outname, FALSE )) {
        return fs_fns->ferrno( );
    }
#endif

#ifdef BUILD_FATFS
    if (fs_fns = myfatfs_realm( normname, &outname, FALSE )) {
        sint32_t r = fs_fns->ferrno( );
        c_free( outname );
        return r;
    }
#endif

    return VFS_RES_ERR;
}
예제 #16
0
파일: lean_path.cpp 프로젝트: codyroux/lean
void init_lean_path() {
#if defined(LEAN_EMSCRIPTEN)
    *g_lean_path = "/library";
    g_lean_path_vector->push_back(*g_lean_path);
#else
    char * r = getenv("LEAN_PATH");
    if (r == nullptr) {
        std::string exe_path = get_path(get_exe_location());
        *g_lean_path  = exe_path + g_sep + ".." + g_sep + "library";
        *g_lean_path += g_path_sep;
        *g_lean_path += exe_path + g_sep + ".." + g_sep + "lib" + g_sep + "lean";
        *g_lean_path += g_path_sep;
        *g_lean_path += ".";
    } else {
        *g_lean_path = r;
    }
    g_lean_path_vector->clear();
    *g_lean_path = normalize_path(*g_lean_path);
    unsigned i  = 0;
    unsigned j  = 0;
    unsigned sz = g_lean_path->size();
    for (; j < sz; j++) {
        if (is_path_sep((*g_lean_path)[j])) {
            if (j > i)
                g_lean_path_vector->push_back(g_lean_path->substr(i, j - i));
            i = j + 1;
        }
    }
    if (j > i)
        g_lean_path_vector->push_back(g_lean_path->substr(i, j - i));
#endif
}
예제 #17
0
int __unlink(struct _reent *r, const char *path) {
    struct file *fp;
    char *npath;
    int res;
    int fd;
    
    npath = normalize_path(path);

    if (!npath) {
        return -1;
    }
    
    if ((fd = open(path, O_WRONLY)) == -1)
        return -1;
    
    if (!(fp = getfile(fd))) {
        close(fd);
        return -1;
    }

    res = (*fp->f_ops->fo_unlink)(fp);
  
    close(fd);
    
    free(npath);
    
    return res;    
}
예제 #18
0
파일: lean_path.cpp 프로젝트: codyroux/lean
std::string dirname(char const * fname) {
    if (fname == nullptr)
        return ".";
    std::string nfname = normalize_path(std::string(fname));
    fname = nfname.c_str();
    unsigned i        = 0;
    unsigned last_sep = 0;
    bool found_sep    = false;
    char const * it   = fname;
    while (*it) {
        if (*it == g_sep) {
            found_sep = true;
            last_sep  = i;
        }
        ++i;
        ++it;
    }
    if (!found_sep) {
        return ".";
    } else {
        std::string r;
        for (unsigned i = 0; i < last_sep; i++)
            r.push_back(fname[i]);
        return r;
    }
}
예제 #19
0
파일: boa.c 프로젝트: joyeboy/boa-libevent
static void fixup_server_root()
{
    char *dirbuf;

    if (!server_root) {
#ifdef SERVER_ROOT
        server_root = strdup(SERVER_ROOT);
        if (!server_root) {
            perror("strdup (SERVER_ROOT)");
            exit(1);
        }
#else
        fputs("boa: don't know where server root is.  Please #define "
              "SERVER_ROOT in boa.h\n"
              "and recompile, or use the -c command line option to "
              "specify it.\n", stderr);
        exit(1);
#endif
    }

    if (chdir(server_root) == -1) {
        fprintf(stderr, "Could not chdir to \"%s\": aborting\n",
                server_root);
        exit(1);
    }

    dirbuf = normalize_path(server_root);
    free(server_root);
    server_root = dirbuf;
}
예제 #20
0
//recursive functions to list filenames and apply filters.
void print_dir_entries(const char *pathname, FILTER *filter, int level) {
    struct dirent **namelist;
    int number_of_names;

    if (level == 0) return;
    if (level > 0) level--;
    number_of_names = scandir(pathname, &namelist, 0, alphasort);
    if (number_of_names < 0) {
        fprintf(stderr, "scandir process %s error:", pathname);
        perror("");
    }
    else {
        while (number_of_names--) {
            char *entry_name = namelist[number_of_names]->d_name;
            if (strcmp(entry_name, ".") == 0 || strcmp(entry_name, "..") == 0) {
                continue;
            }
            filter_files(pathname, namelist[number_of_names], filter);
            if (namelist[number_of_names]->d_type == DT_DIR) {
                print_dir_entries(normalize_path(pathname, entry_name), filter, level);
            }
            free(namelist[number_of_names]);
        }
        free(namelist);
    }
}
예제 #21
0
파일: pathunix.c 프로젝트: cpascal/af-cpp
void path_add_key( OBJECT * path )
{
    struct path_key_entry * result;
    int found;

    if ( ! path_key_cache )
        path_key_cache = hashinit( sizeof( struct path_key_entry ), "path to key" );

    result = (struct path_key_entry *)hash_insert( path_key_cache, path, &found );
    if ( !found )
    {
        string buf[1];
        OBJECT * normalized;
        struct path_key_entry * nresult;
        result->path = path;
        string_copy( buf, object_str( path ) );
        normalize_path( buf );
        normalized = object_new( buf->value );
        string_free( buf );
        nresult = (struct path_key_entry *)hash_insert( path_key_cache, normalized, &found );
        if ( !found || nresult == result )
        {
            nresult->path = object_copy( normalized );
            nresult->key = object_copy( path );
        }
        object_free( normalized );
        if ( nresult != result )
        {
            result->path = object_copy( path );
            result->key = object_copy( nresult->key );
        }
    }
}
예제 #22
0
파일: main.cpp 프로젝트: eranif/codelite
bool is_source_file(const std::string& filename, std::string &fixed_file_name)
{
    StringVec_t extensions;
    extensions.push_back(".cpp");
    extensions.push_back(".cxx");
    extensions.push_back(".cc");
    extensions.push_back(".c");

    for(size_t n=0; n<extensions.size(); ++n) {
        if ( ends_with(filename, extensions.at(n)) ) {
            fixed_file_name = filename;

#ifdef _WIN32
            std::replace(fixed_file_name.begin(), fixed_file_name.end(), '/', '\\');
#endif
            char* ret = normalize_path(fixed_file_name.c_str(), fixed_file_name.length());
            fixed_file_name = ret;
            free(ret);

            // rtrim
            fixed_file_name.erase(0, fixed_file_name.find_first_not_of("\t\r\v\n\" "));

            // ltrim
            fixed_file_name.erase(fixed_file_name.find_last_not_of("\t\r\v\n\" ")+1);
            return true;
        }
    }
    fixed_file_name.clear();
    return false;
}
 task_ptr meta_state_service_simple::get_data(
     const std::string& node,
     task_code cb_code,
     const err_value_callback& cb_get_data,
     clientlet* tracker)
 {
     auto path = normalize_path(node);
     zauto_lock _(_state_lock);
     auto me_it = _quick_map.find(path);
     if (me_it == _quick_map.end())
     {
         return tasking::enqueue(
             cb_code,
             tracker,
             [=]()
             {
                 cb_get_data(ERR_OBJECT_NOT_FOUND, {});
             }
             );
     }
     else
     {
         auto data_copy = me_it->second->data;
         return tasking::enqueue(
             cb_code,
             tracker,
             [=]() mutable
             {
                 cb_get_data(ERR_OK, std::move(data_copy));
             }
             );
     }
 }
예제 #24
0
파일: dir.c 프로젝트: mattknox/Mongrel2
FileRecord *Dir_resolve_file(Dir *dir, bstring path)
{
    FileRecord *file = NULL;
    bstring target = NULL;

    check(Dir_lazy_normalize_base(dir) == 0, "Failed to normalize base path when requesting %s",
            bdata(path));

    check(bstrncmp(path, dir->prefix, blength(dir->prefix)) == 0, 
            "Request for path %s does not start with %s prefix.", 
            bdata(path), bdata(dir->prefix));

    file = FileRecord_cache_check(dir, path);

    if(file) {
        // TODO: double check this gives the right users count
        file->users++;
        return file;
    }

    // We subtract one from the blengths below, because dir->prefix includes
    // a trailing '/'.  If we skip over this in path->data, we drop the '/'
    // from the URI, breaking the target path
    if(bchar(path, blength(path) - 1) == '/') {
        target = bformat("%s%s%s",
                    bdata(dir->normalized_base),
                    path->data + blength(dir->prefix) - 1,
                    bdata(dir->index_file));
    } else {
        target = bformat("%s%s",
                bdata(dir->normalized_base),
                path->data + blength(dir->prefix) - 1);
    }

    check(target, "Couldn't construct target path for %s", bdata(path));

    check_debug(normalize_path(target) == 0, "Failed to normalize target path.");
   
    check_debug(bstrncmp(target, dir->normalized_base, blength(dir->normalized_base)) == 0, 
            "Request for path %s does not start with %s base after normalizing.", 
            bdata(target), bdata(dir->base));

    // the FileRecord now owns the target
    file = Dir_find_file(target, dir->default_ctype);
    check_debug(file, "Error opening file: %s", bdata(target));

    // Increment the user count because we're adding it to the cache
    file->users++;
    file->request_path = bstrcpy(path);
    Cache_add(dir->fr_cache, file);


    return file;

error:
    bdestroy(target);
    FileRecord_release(file);
    return NULL;
}
예제 #25
0
void main( string str) {
  string path;
  object ob;
  object *usr;

  int i;
  int flag;

  string what;
  string who;

  /*  string *words;

      words = explode( str, " " );

      who = words[0]; 
      what = words[1]; */

 sscanf( str, "%s %s", who, what );

  usr = USER_D->query_users();
  flag = 0;
  
  if (strlen(str) > 2) {
    if( (str[strlen(str)-2] == '.') 
	&& (str[strlen(str)-1] == 'c') )
      str = str[..strlen(str)-3];
  }

  path = this_player()->query_env( "cwd" );  

  for( i = 0; i < sizeof( usr ); i++) {
    if( usr[i]->query_name() == who ) {
      flag = 1;
      path = normalize_path( what, path);
      if( !path || path == "" ) {
	write( "Access denied.\n" );
	return;
      }

      /*      write (path + ".c"); */
      /*    write ( path ); */
      if( file_exists( path + ".c") ) {
	ob = clone_object( path );
	  if( ob ) {
	    ob->move(usr[i]->query_player()->query_environment() );
	    usr[i]->query_player()->query_environment()->tell_room( nil, capitalize(article(ob->query_id())) + " " + ob->query_id() + " appears out of nowhere.\n" );
	    write( "You send " + article(ob->query_id() ) + " " + ob->query_id() + " to " + capitalize(who) + ".\n");
	  }
      } else {
	write( "File not found.\n" );
      }
    }
  }
  if (flag == 0){
    write( capitalize(who) + " not found.\n");
  }
}
예제 #26
0
void GroundEyeshot::load(xs::Stream* pMapFile)
{
	m_pMapStream = pMapFile;
	pMapFile->seekToBegin();

	m_vTextures.clear();
	safeDeleteArray(m_pGroundTileTable);

    m_strDistanceTextureFileName.clear();

	xs::DataChunk chunk;
	xs::DataChunk::stChunk *pChunk = chunk.beginChunk(pMapFile);
	while(pChunk)
	{
		switch(pChunk->m_ui32Type)
		{
		case 'MTEX':
			{
				// 纹理列表
				getNameList(m_vTextures,(char*)pChunk->m_pData,pChunk->m_ui32DataSize);
			}
			break;
		case 'MTID':
			{
				// 对应的纹理ID
				m_pGroundTileTable = new DWORD[m_nTotalGridX * m_nTotalGridY];
				memcpy(m_pGroundTileTable,pChunk->m_pData,pChunk->m_ui32DataSize);
			}
			break;

        case 'MDIS':
            {
				// 远景图片
                ASSERT(pChunk->m_pData != NULL);
                BYTE cbFileNameLength = *((BYTE*)(pChunk->m_pData));
                char* szFileName = new char[cbFileNameLength + 1];
                memcpy(szFileName, (BYTE*)(pChunk->m_pData) + sizeof(BYTE), cbFileNameLength);
                szFileName[cbFileNameLength] = 0;
				normalize_path(szFileName,strlen(szFileName));
                SetDistanceTexture(szFileName);

                delete[] szFileName;
            }
            break;
		}
		pChunk = chunk.nextChunk(pMapFile);
	}

	for(int i = 0;i < m_nTotalGridX;i++)
	for(int j = 0;j < m_nTotalGridY;j++)
	{
		GroundTile *pTile = static_cast<GroundTile*>(getGroundTile(i,j));
		m_pMapStream->seek(m_pGroundTileTable[j * m_nTotalGridX + i]);
		pTile->loadBasicInfo(m_pMapStream,m_vTextures);
	}
}
예제 #27
0
/* Recurses opath and adds metadata entries to the metaentry list */
void
mentries_recurse_path(const char *opath, struct metahash **mhash, msettings *st)
{
    char *path = normalize_path(opath);

    if (!(*mhash))
        *mhash = mhash_alloc();
    mentries_recurse(path, *mhash, st);
    free(path);
}
예제 #28
0
파일: system.cpp 프로젝트: jcs12311/pingus
std::string
System::realpath(const std::string& pathname)
{
  std::string fullpath;
  std::string drive;
  
  if (pathname.size() > 0 && pathname[0] == '/')
  {
    fullpath = pathname;
  }
#ifdef WIN32
  else if (pathname.size() > 2 && pathname[1] == ':' && pathname[2] == '/')
  {
    drive = pathname.substr(0, 2);
    fullpath = pathname;
  }
#endif
  else
  {
    char cwd[PATH_MAX];
    if (getcwd(cwd, PATH_MAX) == 0)
    {
      std::cout << "System::realpath: Error: couldn't getcwd()" << std::endl;
      return pathname;
    }
#ifdef WIN32
    for (char *p = cwd; *p; ++p)
    {
      if (*p == '\\')
        *p = '/';
    }
    drive.assign(cwd, 2);
#endif
      
    fullpath = std::string(cwd) + "/" + pathname;
  }

#ifdef WIN32  
  return drive + "/" + normalize_path(fullpath);
#else
  return normalize_path(fullpath);
#endif
}
 error_code meta_state_service_simple::set_data_internal(const std::string& node, const blob& value)
 {
     auto path = normalize_path(node);
     zauto_lock _(_state_lock);
     auto it = _quick_map.find(path);
     if (it == _quick_map.end())
         return ERR_OBJECT_NOT_FOUND;
     it->second->data = value;
     return ERR_OK;
 }
예제 #30
0
void fcFileOpener::AddSearchPath(const std::string& path)
{
	std::string p ( path );
	normalize_path( p );
	if ( IsPathExist( p ) ) {
		return;
	}

	_searchPath.push_back( p );
}