本文整理汇总了C++中PROJECT::project_dir方法的典型用法代码示例。如果您正苦于以下问题:C++ PROJECT::project_dir方法的具体用法?C++ PROJECT::project_dir怎么用?C++ PROJECT::project_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PROJECT
的用法示例。
在下文中一共展示了PROJECT::project_dir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_anonymous
// look for app_versions.xml file in project dir.
// If find, get app versions from there,
// and use "anonymous platform" mechanism for this project
//
void CLIENT_STATE::check_anonymous() {
unsigned int i;
char path[MAXPATHLEN];
FILE* f;
int retval;
for (i=0; i<projects.size(); i++) {
PROJECT* p = projects[i];
sprintf(path, "%s/%s", p->project_dir(), APP_INFO_FILE_NAME);
f = fopen(path, "r");
if (!f) continue;
msg_printf(p, MSG_INFO,
"Found %s; using anonymous platform", APP_INFO_FILE_NAME
);
p->anonymous_platform = true;
// flag as anonymous even if can't parse file
retval = parse_app_info(p, f);
if (retval) {
msg_printf_notice(p, false,
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=app_info",
"%s",
_("Syntax error in app_info.xml")
);
}
fclose(f);
}
}
示例2: get_disk_usages
// populate:
// PROJECT::disk_usage for all projects
// GLOBAL_STATE::client_disk_usage
// GLOBAL_STATE::total_disk_usage
//
int CLIENT_STATE::get_disk_usages() {
unsigned int i;
double size;
PROJECT* p;
int retval;
char buf[MAXPATHLEN];
client_disk_usage = 0;
total_disk_usage = 0;
for (i=0; i<projects.size(); i++) {
p = projects[i];
p->disk_usage = 0;
retval = dir_size(p->project_dir(), size);
if (!retval) p->disk_usage = size;
}
for (i=0; i<active_tasks.active_tasks.size(); i++) {
ACTIVE_TASK* atp = active_tasks.active_tasks[i];
get_slot_dir(atp->slot, buf, sizeof(buf));
retval = dir_size(buf, size);
if (retval) continue;
atp->wup->project->disk_usage += size;
}
for (i=0; i<projects.size(); i++) {
p = projects[i];
total_disk_usage += p->disk_usage;
}
retval = dir_size(".", size, false);
if (!retval) {
client_disk_usage = size;
total_disk_usage += size;
}
return 0;
}
示例3: check_app_config
// check for app_config.xml files, and parse them.
// Called at startup and on read_cc_config() RPC
//
void check_app_config() {
char path[MAXPATHLEN];
FILE* f;
for (unsigned int i=0; i<gstate.projects.size(); i++) {
PROJECT* p = gstate.projects[i];
sprintf(path, "%s/%s", p->project_dir(), APP_CONFIG_FILE_NAME);
f = boinc_fopen(path, "r");
if (!f) {
clear_app_config(p);
continue;
}
msg_printf(p, MSG_INFO, "Found %s", APP_CONFIG_FILE_NAME);
int retval = p->app_configs.parse_file(f, p);
if (!retval) {
p->app_configs.config_app_versions(p, true);
}
fclose(f);
}
}
示例4: add_project
int CLIENT_STATE::add_project(
const char* master_url, const char* _auth, const char* project_name,
bool attached_via_acct_mgr
) {
char path[MAXPATHLEN], canonical_master_url[256], auth[256];
PROJECT* project;
FILE* f;
int retval;
if (cc_config.disallow_attach) {
return ERR_USER_PERMISSION;
}
safe_strcpy(canonical_master_url, master_url);
strip_whitespace(canonical_master_url);
canonicalize_master_url(canonical_master_url, sizeof(canonical_master_url));
if (!valid_master_url(canonical_master_url)) {
msg_printf(0, MSG_INFO, "Invalid URL: %s", canonical_master_url);
return ERR_INVALID_URL;
}
safe_strcpy(auth, _auth);
strip_whitespace(auth);
if (!strlen(auth)) {
msg_printf(0, MSG_INFO, "Missing account key");
return ERR_AUTHENTICATOR;
}
// check if we're already attached to this project
//
if (lookup_project(canonical_master_url)) {
msg_printf(0, MSG_INFO, "Already attached to %s", canonical_master_url);
return ERR_ALREADY_ATTACHED;
}
// create project state
//
project = new PROJECT;
safe_strcpy(project->master_url, canonical_master_url);
safe_strcpy(project->authenticator, auth);
safe_strcpy(project->project_name, project_name);
project->attached_via_acct_mgr = attached_via_acct_mgr;
retval = project->write_account_file();
if (retval) {
delete project;
return retval;
}
get_account_filename(canonical_master_url, path, sizeof(path));
f = boinc_fopen(path, "r");
if (!f) {
delete project;
return ERR_FOPEN;
}
retval = project->parse_account(f);
fclose(f);
if (retval) {
delete project;
return retval;
}
// remove any old files
// (unless PROJECT/app_info.xml is found, so that
// people using anonymous platform don't have to get apps again)
//
sprintf(path, "%s/%s", project->project_dir(), APP_INFO_FILE_NAME);
if (boinc_file_exists(path)) {
project->anonymous_platform = true;
f = fopen(path, "r");
if (f) {
parse_app_info(project, f);
fclose(f);
}
} else {
retval = remove_project_dir(*project);
}
retval = make_project_dir(*project);
if (retval) {
delete project;
return retval;
}
projects.push_back(project);
sort_projects_by_name();
project->sched_rpc_pending = RPC_REASON_INIT;
set_client_state_dirty("Add project");
return 0;
}