Ticket #2185: src_servers_registrar_TRoster.cpp.diff

File src_servers_registrar_TRoster.cpp.diff, 2.3 KB (added by kaoutsis, 16 years ago)
  • src/servers/registrar/TRoster.cpp

     
    7676//! The maximal period of time an app may be early pre-registered (60 s).
    7777const bigtime_t kMaximalEarlyPreRegistrationPeriod = 60000000LL;
    7878
    79 //! Applications living in this tree are considered "vital system apps".
    80 static const char *const kVitalSystemAppPathPrefix
    81     = "/boot/beos/system/servers";
    82 
    83 //! Applications living in this tree are considered "system apps".
    84 static const char *const kSystemAppPathPrefix = "/boot/beos/system";
    85 
    8679// get_default_roster_settings_file
    8780/*! \brief Returns the path to the default roster settings.
    8881    \param path BPath to be set to the roster settings path.
     
    9386get_default_roster_settings_file(BPath &path)
    9487{
    9588    // get the path of the settings dir and append the subpath of our file
    96     status_t error = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
    97     if (error == B_OK)
    98         error = path.Append("Roster/HaikuRosterSettings");
     89    status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path);
     90    if (status == B_OK)
     91        status = path.Append("Roster/HaikuRosterSettings");
     92    if (status < B_OK) {
     93        D(PRINT(("Composing the path failed! At %s, %s, %d.\n"
     94            "Reason: %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__,
     95            strerror(status))));
     96        return NULL;
     97    }
    9998
    100     // If some error occurred, set the standard path (can only fail, if there's
    101     // insufficient memory, which can't be helped anyway).
    102     if (error != B_OK)
    103         path.SetTo("/boot/home/config/settings/Roster/HaikuRosterSettings");
    104 
    10599    return path.Path();
    106100}
    107101
     
    17901784        return false;
    17911785
    17921786    int len = strlen(path.Path());
    1793     int prefixLen = strlen(kSystemAppPathPrefix);
     1787    BPath systemPath;
     1788    status_t status = find_directory(B_BEOS_SYSTEM_DIRECTORY, &systemPath);
     1789    if (status < B_OK) {
     1790        D(PRINT(("find_directory() failed! At %s, %s, %d.\n"
     1791            "Reason: %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__,
     1792            strerror(status))));
     1793    }
     1794
     1795    int prefixLen = strlen(systemPath.Path());
    17941796    return (len > prefixLen
    1795         && strncmp(path.Path(), kSystemAppPathPrefix, prefixLen) == 0);
     1797        && strncmp(path.Path(), systemPath.Path(), prefixLen) == 0);
    17961798}
    17971799
    17981800status_t