Changeset 3440

Show
Ignore:
Timestamp:
07/14/08 11:46:31 (1 month ago)
Author:
dgollub
Message:

Don't use '/' in ANY path. Use the dir separtaor character.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/opensync/client/opensync_client_proxy.c

    r3395 r3440  
    110110/*static char *_osync_client_pid_filename(OSyncClientProxy *proxy) 
    111111{ 
    112         return g_strdup_printf("%s/osplugin.pid", proxy->path); 
     112        return g_strdup_printf("%s%cosplugin.pid", proxy->path, G_DIR_SEPARATOR); 
    113113}*/ 
    114114 
     
    896896                        goto error; 
    897897        } else { 
    898                 char *name = g_strdup_printf("%s/pluginpipe", path); 
     898                char *name = g_strdup_printf("%s%cpluginpipe", path, G_DIR_SEPARATOR); 
    899899                proxy->outgoing = osync_queue_new(name, error); 
    900900                g_free(name); 
     
    902902                        goto error; 
    903903                 
    904                 name = g_strdup_printf("%s/enginepipe", path); 
     904                name = g_strdup_printf("%s%cenginepipe", path, G_DIR_SEPARATOR); 
    905905                proxy->incoming = osync_queue_new(name, error); 
    906906                g_free(name); 
  • trunk/opensync/engine/opensync_engine.c

    r3365 r3440  
    381381                osync_trace(TRACE_INTERNAL, "No config dir found. Making stateless sync"); 
    382382        } else { 
    383                 char *filename = g_strdup_printf("%s/archive.db", osync_group_get_configdir(group)); 
     383                char *filename = g_strdup_printf("%s%carchive.db", osync_group_get_configdir(group), G_DIR_SEPARATOR); 
    384384                engine->archive = osync_archive_new(filename, error); 
    385385                g_free(filename); 
     
    406406        g_main_context_ref(engine->context); 
    407407 
    408         char *enginesdir = g_strdup_printf("%s/.opensync/engines", g_get_home_dir()); 
    409         engine->engine_path = g_strdup_printf("%s/enginepipe", enginesdir); 
     408        char *enginesdir = g_strdup_printf("%s%c.opensync%cengines", g_get_home_dir(), G_DIR_SEPARATOR, G_DIR_SEPARATOR); 
     409        engine->engine_path = g_strdup_printf("%s%cenginepipe", enginesdir, G_DIR_SEPARATOR); 
    410410         
    411411        if (g_mkdir_with_parents(enginesdir, 0755) < 0) { 
  • trunk/opensync/format/opensync_format_env.c

    r3318 r3440  
    7070         
    7171        while ((de = g_dir_read_name(dir))) { 
    72                 filename = g_strdup_printf ("%s/%s", path, de); 
     72                filename = g_strdup_printf ("%s%c%s", path, G_DIR_SEPARATOR, de); 
    7373                 
    7474                if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR) || !g_pattern_match_simple("*.so", filename)) { 
  • trunk/opensync/group/opensync_group.c

    r3407 r3440  
    9494                if (filename) 
    9595                        g_free(filename); 
    96                 filename = g_strdup_printf("%s/%lli", group->configdir, i); 
     96                filename = g_strdup_printf("%s%c%lli", group->configdir, G_DIR_SEPARATOR, i); 
    9797        } while (g_file_test(filename, G_FILE_TEST_EXISTS)); 
    9898         
     
    130130 
    131131        while ((de = g_dir_read_name(dir))) { 
    132                 filename = g_strdup_printf ("%s/%s/syncmember.conf", osync_group_get_configdir(group), de); 
     132                filename = g_strdup_printf ("%s%c%s%csyncmember.conf", osync_group_get_configdir(group), G_DIR_SEPARATOR, de, G_DIR_SEPARATOR); 
    133133                if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) { 
    134134                        g_free(filename); 
     
    146146#endif /* OPENSYNC_UNITTESTS */ 
    147147                 
    148                 member_path = g_strdup_printf ("%s/%s", osync_group_get_configdir(group), de); 
     148                member_path = g_strdup_printf ("%s%c%s", osync_group_get_configdir(group), G_DIR_SEPARATOR, de); 
    149149                if (!osync_member_load(member, member_path, error)) { 
    150150                        g_free(member_path); 
     
    377377        } 
    378378         
    379         lockfile = g_strdup_printf("%s/lock", group->configdir); 
     379        lockfile = g_strdup_printf("%s%clock", group->configdir, G_DIR_SEPARATOR); 
    380380 
    381381        if (g_file_test(lockfile, G_FILE_TEST_EXISTS)) { 
     
    463463        group->lock_fd = 0; 
    464464         
    465         lockfile = g_strdup_printf("%s/lock", group->configdir); 
     465        lockfile = g_strdup_printf("%s%clock", group->configdir, G_DIR_SEPARATOR); 
    466466         
    467467        g_unlink(lockfile); 
     
    531531        } 
    532532         
    533         filename = g_strdup_printf ("%s/syncgroup.conf", group->configdir); 
     533        filename = g_strdup_printf ("%s%csyncgroup.conf", group->configdir, G_DIR_SEPARATOR); 
    534534        osync_trace(TRACE_INTERNAL, "Saving group to file %s", filename); 
    535535         
     
    653653 
    654654                /* flush hashtable */ 
    655                 path = g_strdup_printf("%s/hashtable.db", osync_member_get_configdir(member)); 
     655                path = g_strdup_printf("%s%chashtable.db", osync_member_get_configdir(member), G_DIR_SEPARATOR); 
    656656                if (!(db = osync_db_new(error))) 
    657657                        goto error_and_free; 
     
    665665 
    666666                /* flush anchor db */  
    667                 path = g_strdup_printf("%s/anchor.db", osync_member_get_configdir(member)); 
     667                path = g_strdup_printf("%s%canchor.db", osync_member_get_configdir(member), G_DIR_SEPARATOR); 
    668668                if (!(db = osync_db_new(error))) 
    669669                        goto error_and_free; 
     
    678678        } 
    679679 
    680         path = g_strdup_printf("%s/archive.db", osync_group_get_configdir(group)); 
     680        path = g_strdup_printf("%s%carchive.db", osync_group_get_configdir(group), G_DIR_SEPARATOR); 
    681681        if (!(db = osync_db_new(error))) 
    682682                goto error_and_free; 
     
    723723        if (!g_path_is_absolute(path)) { 
    724724                char *curdir = g_get_current_dir(); 
    725                 real_path = g_strdup_printf("%s/%s", curdir, path); 
     725                real_path = g_strdup_printf("%s%c%s", curdir, G_DIR_SEPARATOR, path); 
    726726                g_free(curdir); 
    727727        } else { 
     
    730730         
    731731        osync_group_set_configdir(group, real_path); 
    732         filename = g_strdup_printf("%s/syncgroup.conf", real_path); 
     732        filename = g_strdup_printf("%s%csyncgroup.conf", real_path, G_DIR_SEPARATOR); 
    733733        g_free(real_path); 
    734734         
     
    860860         
    861861        if (!osync_member_get_configdir(member)) { 
    862                 char *configdir = g_strdup_printf("%s/%lli", group->configdir, _osync_group_create_member_id(group)); 
     862                char *configdir = g_strdup_printf("%s%c%lli", group->configdir, G_DIR_SEPARATOR, _osync_group_create_member_id(group)); 
    863863                osync_member_set_configdir(member, configdir); 
    864864                g_free(configdir); 
  • trunk/opensync/group/opensync_group_env.c

    r3353 r3440  
    6464                if (filename) 
    6565                        g_free(filename); 
    66                 filename = g_strdup_printf("%s/group%lli", env->groupsdir, i); 
     66                filename = g_strdup_printf("%s%cgroup%lli", env->groupsdir, G_DIR_SEPARATOR, i); 
    6767        } while (g_file_test(filename, G_FILE_TEST_EXISTS)); 
    6868        g_free(filename); 
     
    176176                        homedir = g_get_home_dir(); 
    177177 
    178                 env->groupsdir = g_strdup_printf("%s/.opensync", homedir); 
     178                env->groupsdir = g_strdup_printf("%s%c.opensync", homedir, G_DIR_SEPARATOR); 
    179179                osync_trace(TRACE_INTERNAL, "Default home dir: %s", env->groupsdir); 
    180180                 
     
    188188        } else { 
    189189                if (!g_path_is_absolute(path)) { 
    190                         env->groupsdir = g_strdup_printf("%s/%s", g_get_current_dir(), path); 
     190                        env->groupsdir = g_strdup_printf("%s%c%s", g_get_current_dir(), G_DIR_SEPARATOR, path); 
    191191                } else { 
    192192                        env->groupsdir = g_strdup(path); 
     
    208208         
    209209        while ((de = g_dir_read_name(dir))) { 
    210                 filename = g_strdup_printf ("%s/%s", env->groupsdir, de); 
     210                filename = g_strdup_printf ("%s%c%s", env->groupsdir, G_DIR_SEPARATOR, de); 
    211211                 
    212212                if (!g_file_test(filename, G_FILE_TEST_IS_DIR) || !g_pattern_match_simple("group*", de)) { 
     
    302302         
    303303        if (!osync_group_get_configdir(group)) { 
    304                 char *configdir = g_strdup_printf("%s/group%lli", env->groupsdir, _osync_group_env_create_group_id(env)); 
     304                char *configdir = g_strdup_printf("%s%cgroup%lli", env->groupsdir, G_DIR_SEPARATOR, _osync_group_env_create_group_id(env)); 
    305305                osync_group_set_configdir(group, configdir); 
    306306                g_free(configdir); 
  • trunk/opensync/group/opensync_member.c

    r3407 r3440  
    440440        } 
    441441         
    442         filename = g_strdup_printf("%s/%s.conf", member->configdir, member->pluginname); 
     442        filename = g_strdup_printf("%s%c%s.conf", member->configdir, G_DIR_SEPARATOR, member->pluginname); 
    443443        osync_trace(TRACE_INTERNAL, "Reading config from: %s", filename); 
    444444         
     
    511511        osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, member, path, error); 
    512512 
    513         filename = g_strdup_printf ("%s/syncmember.conf", path); 
     513        filename = g_strdup_printf ("%s%csyncmember.conf", path, G_DIR_SEPARATOR); 
    514514         
    515515        basename = g_path_get_basename(path); 
     
    700700 
    701701        //Saving the syncmember.conf 
    702         filename = g_strdup_printf ("%s/syncmember.conf", member->configdir); 
     702        filename = g_strdup_printf ("%s%csyncmember.conf", member->configdir, G_DIR_SEPARATOR); 
    703703        xmlSaveFormatFile(filename, doc, 1); 
    704704        g_free(filename); 
     
    708708        //Saving the config if it exists 
    709709        if (member->config) { 
    710                 filename = g_strdup_printf("%s/%s.conf", member->configdir, member->pluginname); 
     710                filename = g_strdup_printf("%s%c%s.conf", member->configdir, G_DIR_SEPARATOR, member->pluginname); 
    711711                if (!osync_plugin_config_file_save(member->config, filename, error)) { 
    712712                        g_free(filename); 
  • trunk/opensync/group/opensync_updater.c

    r3173 r3440  
    453453 
    454454        while ((de = g_dir_read_name(dir))) { 
    455                 member_path = g_strdup_printf("%s/%s/", backup_groupdir, de); 
     455                member_path = g_strdup_printf("%s%c%s%c", backup_groupdir, G_DIR_SEPARATOR, de, G_DIR_SEPARATOR); 
    456456                if (!g_file_test(member_path, G_FILE_TEST_IS_DIR)) { 
    457457                        g_free(member_path); 
     
    476476                } 
    477477 
    478                 member_path = g_strdup_printf("%s/%s/", orig_groupdir, de); 
     478                member_path = g_strdup_printf("%s%c%s%c", orig_groupdir, G_DIR_SEPARATOR, de, G_DIR_SEPARATOR); 
    479479                if (g_mkdir(member_path, orig_stat.st_mode) < 0) {  
    480480                        g_set_error(&gerror, G_FILE_ERROR, errno, NULL); 
     
    487487 
    488488                while ((member_de = g_dir_read_name(member_dir))) { 
    489                         config = g_strdup_printf("%s/%s/%s", backup_groupdir, de, member_de); 
     489                        config = g_strdup_printf("%s%c%s%c%s", backup_groupdir, G_DIR_SEPARATOR, de, G_DIR_SEPARATOR, member_de); 
    490490                         
    491491                        /* Only copy files ending with ".conf" */ 
     
    503503                        g_free(config); 
    504504 
    505                         copy_config = g_strdup_printf("%s/%s/%s", orig_groupdir, de, member_de); 
     505                        copy_config = g_strdup_printf("%s%c%s%c%s", orig_groupdir, G_DIR_SEPARATOR, de, G_DIR_SEPARATOR, member_de); 
    506506 
    507507                        if (!g_file_set_contents(copy_config, content, length, &gerror)) { 
     
    523523 
    524524 
    525         config = g_strdup_printf("%s/%s", backup_groupdir, "syncgroup.conf"); 
     525        config = g_strdup_printf("%s%c%s", backup_groupdir, G_DIR_SEPARATOR, "syncgroup.conf"); 
    526526 
    527527        if (!g_file_get_contents(config, &content, &length, &gerror)) { 
     
    533533        g_free(config); 
    534534 
    535         copy_config = g_strdup_printf("%s/%s", orig_groupdir, "syncgroup.conf"); 
     535        copy_config = g_strdup_printf("%s%c%s", orig_groupdir, G_DIR_SEPARATOR, "syncgroup.conf"); 
    536536 
    537537        if (!g_file_set_contents(copy_config, content, length, &gerror)) { 
  • trunk/opensync/opensync_support.c

    r3256 r3440  
    167167        endline = "\n"; 
    168168#endif 
    169         logfile = g_strdup_printf("%s/Thread%lu-%i.log", trace, id, pid); 
     169        logfile = g_strdup_printf("%s%cThread%lu-%i.log", trace, G_DIR_SEPARATOR, id, pid); 
    170170         
    171171        va_start(arglist, message); 
  • trunk/opensync/plugin/opensync_plugin_env.c

    r3224 r3440  
    146146         
    147147        while ((de = g_dir_read_name(dir))) { 
    148                 filename = g_strdup_printf ("%s/%s", path, de); 
     148                filename = g_strdup_printf ("%s%c%s", path, G_DIR_SEPARATOR, de); 
    149149                 
    150150                if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR) || !g_pattern_match_simple("*.so", filename)) { 
  • trunk/opensync/version/opensync_version.c

    r3174 r3440  
    125125         
    126126        while ((de = g_dir_read_name(dir))) { 
    127                 filename = g_strdup_printf ("%s/%s", descpath, de); 
     127                filename = g_strdup_printf ("%s%c%s", descpath, G_DIR_SEPARATOR, de); 
    128128                 
    129129                if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR) || !g_pattern_match_simple("*.xml", filename)) {