Changeset 2885

Show
Ignore:
Timestamp:
11/30/07 11:22:24 (1 year ago)
Author:
paule
Message:

Only get root path once on connect instead of before every transfer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/opie-sync/src/opie_comms.c

    r2780 r2885  
    234234{ 
    235235        osync_trace(TRACE_ENTRY, "%s(%p)", __func__, env); 
    236         char* root_path; 
    237          
    238         if ( env->use_qcop ) { 
    239                 root_path = qcop_get_root(env->qcopconn); 
    240                 if(!root_path) { 
    241                         fprintf(stderr, "qcop_get_root: %s\n", env->qcopconn->resultmsg); 
    242                         osync_trace(TRACE_EXIT_ERROR, "qcop_get_root: %s", env->qcopconn->resultmsg); 
    243                         return NULL; 
    244                 } 
    245                 osync_trace( TRACE_INTERNAL, "QCop root path = %s", root_path ); 
    246         } 
    247         else 
    248                 root_path = g_strdup( "" ); 
    249          
     236 
    250237        char *notes_path; 
    251238        if(env->notes_type == NOTES_TYPE_OPIE_NOTES) 
    252                 notes_path = g_build_filename(root_path, "Documents/text/plain", NULL); 
     239                notes_path = g_build_filename(env->dev_root_path, "Documents/text/plain", NULL); 
    253240        else 
    254                 notes_path = g_strdup(root_path); 
    255          
    256         g_free(root_path); 
     241                notes_path = g_strdup(env->dev_root_path); 
    257242         
    258243        osync_trace(TRACE_EXIT, "%s(%s)", __func__, notes_path); 
     
    586571        if (env->host && env->username && env->password ) 
    587572        { 
    588                 char* separator_path; 
    589                 if ( env->use_qcop )  
    590                 { 
    591                         char* root_path = qcop_get_root(env->qcopconn); 
    592                         if(!root_path) { 
    593                                 fprintf(stderr, "qcop_get_root: %s\n", env->qcopconn->resultmsg); 
    594                                 osync_trace(TRACE_EXIT_ERROR, "qcop_get_root: %s", env->qcopconn->resultmsg); 
    595                                 return FALSE; 
    596                         } 
    597                         osync_trace( TRACE_INTERNAL, "QCop root path = %s", root_path ); 
    598                         separator_path = g_strdup_printf("%s/", root_path); 
    599                         g_free(root_path); 
    600                 } else { 
    601                         separator_path = g_strdup( "/" ); 
    602                 } 
     573                char* separator_path = g_strdup_printf("%s/", env->dev_root_path); 
    603574 
    604575                /* fetch each of the requested files */ 
     
    988959        if (env->host && env->username && env->password ) 
    989960        { 
    990                 if ( env->use_qcop )  
    991                 { 
    992                         char* root_path = qcop_get_root(env->qcopconn); 
    993                         if(!root_path) { 
    994                                 fprintf(stderr, "qcop_get_root: %s\n", env->qcopconn->resultmsg); 
    995                                 osync_trace(TRACE_EXIT_ERROR, "qcop_get_root: %s", env->qcopconn->resultmsg); 
    996                                 return FALSE; 
    997                         } 
    998                         osync_trace( TRACE_INTERNAL, "QCop root path = %s", root_path ); 
    999                         separator_path = g_strdup_printf("%s/", root_path); 
    1000                         g_free(root_path); 
    1001                 } else { 
    1002                         separator_path = g_strdup( "/" ); 
    1003                 } 
     961                char* separator_path = g_strdup_printf("%s/", env->dev_root_path); 
    1004962                 
    1005963                char *ftpurl = g_strdup_printf("ftp://%s:%s@%s:%u%s%s", 
  • plugins/opie-sync/src/opie_sync.c

    r2624 r2885  
    191191                        goto error; 
    192192                } 
    193                  
    194         } 
     193 
     194                env->dev_root_path = qcop_get_root(env->qcopconn); 
     195                if(!env->dev_root_path) { 
     196                        char *errmsg = g_strdup_printf("qcop_get_root failed: %s\n", env->qcopconn->resultmsg); 
     197                        osync_error_set(error, OSYNC_ERROR_GENERIC, errmsg); 
     198                        g_free(errmsg); 
     199                        qcop_stop_sync(env->qcopconn); 
     200                        goto error; 
     201                } 
     202                osync_trace( TRACE_INTERNAL, "QCop root path = %s", env->dev_root_path ); 
     203        } 
     204        else 
     205                env->dev_root_path = g_strdup( "" ); 
    195206 
    196207        osync_trace(TRACE_EXIT, "%s", __func__); 
  • plugins/opie-sync/src/opie_sync.h

    r2478 r2885  
    7979        qcop_conn*        qcopconn; 
    8080        gboolean          connected; 
     81        gchar*            dev_root_path; 
    8182 
    8283        xmlDoc*           categories_doc;