2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-10-16 19:03:49 +00:00
|
|
|
#include "cpp.h"
|
2002-06-06 18:42:01 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2004-06-16 23:16:08 +00:00
|
|
|
#include "boinc_win.h"
|
2009-08-22 17:00:19 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define snprintf _snprintf
|
|
|
|
#endif
|
2010-05-11 19:10:29 +00:00
|
|
|
#else
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
2002-04-30 22:22:54 +00:00
|
|
|
#include <sys/stat.h>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cctype>
|
2007-06-28 11:10:01 +00:00
|
|
|
#if HAVE_SYS_IPC_H
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#endif
|
|
|
|
#include "shmem.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-08-24 00:41:25 +00:00
|
|
|
#include "filesys.h"
|
2002-07-11 01:09:53 +00:00
|
|
|
#include "error_numbers.h"
|
2007-02-21 16:26:51 +00:00
|
|
|
#include "str_util.h"
|
2009-06-16 20:54:44 +00:00
|
|
|
#include "str_replace.h"
|
2009-11-05 18:02:51 +00:00
|
|
|
#include "url.h"
|
2006-07-18 01:46:55 +00:00
|
|
|
#include "util.h"
|
2004-04-08 08:15:23 +00:00
|
|
|
#include "client_msgs.h"
|
2007-10-05 16:47:07 +00:00
|
|
|
#include "sandbox.h"
|
2007-10-09 00:34:38 +00:00
|
|
|
#include "client_state.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
|
2003-07-03 05:01:29 +00:00
|
|
|
#include "file_names.h"
|
|
|
|
|
2009-06-02 00:22:45 +00:00
|
|
|
int make_soft_link(PROJECT* project, char* link_path, char* rel_file_path) {
|
|
|
|
FILE *fp = boinc_fopen(link_path, "w");
|
|
|
|
if (!fp) {
|
|
|
|
msg_printf(project, MSG_INTERNAL_ERROR,
|
|
|
|
"Can't create link file %s", link_path
|
|
|
|
);
|
|
|
|
return ERR_FOPEN;
|
|
|
|
}
|
|
|
|
fprintf(fp, "<soft_link>%s</soft_link>\n", rel_file_path);
|
|
|
|
fclose(fp);
|
|
|
|
if (log_flags.slot_debug) {
|
|
|
|
msg_printf(project, MSG_INFO,
|
|
|
|
"[slot] linked %s to %s", rel_file_path, link_path
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_project_dir(PROJECT* p, char* path, int len) {
|
|
|
|
char buf[1024];
|
2004-01-04 06:48:40 +00:00
|
|
|
escape_project_url(p->master_url, buf);
|
2007-03-13 19:33:27 +00:00
|
|
|
snprintf(path, len, "%s/%s", PROJECTS_DIR, buf);
|
2004-01-04 06:48:40 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 23:21:20 +00:00
|
|
|
// Gets the pathname of a file
|
|
|
|
//
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_pathname(FILE_INFO* fip, char* path, int len) {
|
2002-04-30 22:22:54 +00:00
|
|
|
PROJECT* p = fip->project;
|
2007-03-13 19:33:27 +00:00
|
|
|
char buf[1024];
|
2002-08-05 00:29:34 +00:00
|
|
|
|
2002-07-05 05:33:40 +00:00
|
|
|
// for testing purposes, it's handy to allow a FILE_INFO without
|
|
|
|
// an associated PROJECT.
|
|
|
|
//
|
|
|
|
if (p) {
|
2011-02-24 22:18:14 +00:00
|
|
|
#ifdef ENABLE_AUTO_UPDATE
|
2011-01-06 23:09:13 +00:00
|
|
|
if (fip->is_auto_update_file) {
|
|
|
|
boinc_version_dir(*p, gstate.auto_update.version, buf);
|
|
|
|
} else {
|
2007-03-13 19:33:27 +00:00
|
|
|
get_project_dir(p, buf, sizeof(buf));
|
2011-01-06 23:09:13 +00:00
|
|
|
}
|
2011-02-24 22:18:14 +00:00
|
|
|
#else
|
|
|
|
get_project_dir(p, buf, sizeof(buf));
|
|
|
|
#endif
|
2011-01-06 23:09:13 +00:00
|
|
|
snprintf(path, len, "%s/%s", buf, fip->name);
|
|
|
|
} else {
|
2007-03-13 19:33:27 +00:00
|
|
|
strlcpy(path, fip->name, len);
|
2002-07-05 05:33:40 +00:00
|
|
|
}
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_sched_request_filename(PROJECT& project, char* buf, int len) {
|
|
|
|
char url[1024];
|
2004-09-22 22:09:54 +00:00
|
|
|
|
2004-09-22 22:28:25 +00:00
|
|
|
escape_project_url(project.master_url, url);
|
2007-03-13 19:33:27 +00:00
|
|
|
snprintf(buf, len, "%s%s.xml", SCHED_OP_REQUEST_BASE, url);
|
2004-09-22 22:09:54 +00:00
|
|
|
}
|
|
|
|
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_sched_reply_filename(PROJECT& project, char* buf, int len) {
|
|
|
|
char url[1024];
|
2004-09-22 22:09:54 +00:00
|
|
|
|
2004-09-22 22:28:25 +00:00
|
|
|
escape_project_url(project.master_url, url);
|
2007-03-13 19:33:27 +00:00
|
|
|
snprintf(buf, len, "%s%s.xml", SCHED_OP_REPLY_BASE, url);
|
2004-09-22 22:09:54 +00:00
|
|
|
}
|
|
|
|
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_master_filename(PROJECT& project, char* buf, int len) {
|
|
|
|
char url[1024];
|
2005-03-10 00:43:22 +00:00
|
|
|
|
|
|
|
escape_project_url(project.master_url, url);
|
2007-03-13 19:33:27 +00:00
|
|
|
snprintf(buf, len, "%s%s.xml", MASTER_BASE, url);
|
2005-03-10 00:43:22 +00:00
|
|
|
}
|
|
|
|
|
2007-04-13 04:22:20 +00:00
|
|
|
void job_log_filename(PROJECT& project, char* buf, int len) {
|
|
|
|
char url[1024];
|
|
|
|
|
|
|
|
escape_project_url(project.master_url, url);
|
2007-04-20 17:14:08 +00:00
|
|
|
snprintf(buf, len, "%s%s.txt", JOB_LOG_BASE, url);
|
2007-04-13 04:22:20 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 23:21:20 +00:00
|
|
|
// Returns the location of a numbered slot directory
|
|
|
|
//
|
2007-03-13 19:33:27 +00:00
|
|
|
void get_slot_dir(int slot, char* path, int len) {
|
|
|
|
snprintf(path, len, "%s/%d", SLOTS_DIR, slot);
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 23:21:20 +00:00
|
|
|
// Create the directory for the project p
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
int make_project_dir(PROJECT& p) {
|
2007-03-13 19:33:27 +00:00
|
|
|
char buf[1024];
|
2004-04-20 23:04:05 +00:00
|
|
|
int retval;
|
2002-06-21 06:52:47 +00:00
|
|
|
|
2003-05-13 18:55:07 +00:00
|
|
|
boinc_mkdir(PROJECTS_DIR);
|
2006-08-01 16:09:41 +00:00
|
|
|
#ifndef _WIN32
|
2008-01-16 22:10:34 +00:00
|
|
|
mode_t old_mask;
|
2006-08-01 12:36:19 +00:00
|
|
|
if (g_use_sandbox) {
|
2010-01-27 07:38:29 +00:00
|
|
|
old_mask = umask(2); // Allow writing by group
|
2008-01-16 10:38:21 +00:00
|
|
|
chmod(PROJECTS_DIR,
|
2007-12-12 04:52:30 +00:00
|
|
|
S_IRUSR|S_IWUSR|S_IXUSR
|
|
|
|
|S_IRGRP|S_IWGRP|S_IXGRP
|
|
|
|
);
|
2008-01-16 10:38:21 +00:00
|
|
|
umask(old_mask);
|
2011-01-06 23:09:13 +00:00
|
|
|
// Only user boinc_master and group boinc_project can access
|
2010-01-27 07:38:29 +00:00
|
|
|
// project directories, to keep authenticators private
|
2010-03-16 09:52:45 +00:00
|
|
|
set_to_project_group(PROJECTS_DIR);
|
2006-08-01 12:36:19 +00:00
|
|
|
}
|
2006-08-01 16:09:41 +00:00
|
|
|
#endif
|
2007-03-13 19:33:27 +00:00
|
|
|
get_project_dir(&p, buf, sizeof(buf));
|
2004-04-20 23:04:05 +00:00
|
|
|
retval = boinc_mkdir(buf);
|
2006-08-01 16:09:41 +00:00
|
|
|
#ifndef _WIN32
|
2006-08-01 12:36:19 +00:00
|
|
|
if (g_use_sandbox) {
|
2010-01-27 07:38:29 +00:00
|
|
|
old_mask = umask(2);
|
2011-01-06 23:09:13 +00:00
|
|
|
// Contents of projects directory must be world-readable so BOINC Client can read
|
2010-01-27 07:38:29 +00:00
|
|
|
// files written by projects which have user boinc_project and group boinc_project
|
2006-08-01 12:36:19 +00:00
|
|
|
chmod(buf,
|
2007-12-12 04:52:30 +00:00
|
|
|
S_IRUSR|S_IWUSR|S_IXUSR
|
|
|
|
|S_IRGRP|S_IWGRP|S_IXGRP
|
|
|
|
|S_IROTH|S_IXOTH
|
|
|
|
);
|
2008-01-16 10:38:21 +00:00
|
|
|
umask(old_mask);
|
2006-08-01 12:36:19 +00:00
|
|
|
set_to_project_group(buf);
|
|
|
|
}
|
2006-08-01 16:09:41 +00:00
|
|
|
#endif
|
2004-04-20 23:04:05 +00:00
|
|
|
return retval;
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
|
|
|
|
2002-12-02 20:52:22 +00:00
|
|
|
int remove_project_dir(PROJECT& p) {
|
2007-03-13 19:33:27 +00:00
|
|
|
char buf[1024];
|
2004-05-24 19:00:26 +00:00
|
|
|
int retval;
|
2002-12-02 20:52:22 +00:00
|
|
|
|
2007-03-13 19:33:27 +00:00
|
|
|
get_project_dir(&p, buf, sizeof(buf));
|
2009-05-28 19:26:27 +00:00
|
|
|
retval = client_clean_out_dir(buf, "remove project dir");
|
2004-05-24 19:00:26 +00:00
|
|
|
if (retval) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(&p, MSG_INTERNAL_ERROR, "Can't delete file %s", boinc_failed_file);
|
2004-05-24 19:00:26 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2007-10-09 00:34:38 +00:00
|
|
|
return remove_project_owned_dir(buf);
|
2002-12-02 20:52:22 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 23:21:20 +00:00
|
|
|
// Create the slot directory for the specified slot #
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
int make_slot_dir(int slot) {
|
2007-03-13 19:33:27 +00:00
|
|
|
char buf[1024];
|
2008-01-16 10:38:21 +00:00
|
|
|
|
2004-04-14 23:32:17 +00:00
|
|
|
if (slot<0) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_INTERNAL_ERROR, "Bad slot number %d", slot);
|
2002-07-11 01:09:53 +00:00
|
|
|
return ERR_NEG;
|
|
|
|
}
|
2003-05-13 18:55:07 +00:00
|
|
|
boinc_mkdir(SLOTS_DIR);
|
2006-08-01 16:09:41 +00:00
|
|
|
#ifndef _WIN32
|
2008-01-16 22:10:34 +00:00
|
|
|
mode_t old_mask;
|
2006-08-01 12:36:19 +00:00
|
|
|
if (g_use_sandbox) {
|
2010-01-27 07:38:29 +00:00
|
|
|
old_mask = umask(2); // Allow writing by group
|
2006-08-01 12:36:19 +00:00
|
|
|
chmod(SLOTS_DIR,
|
2007-12-12 04:52:30 +00:00
|
|
|
S_IRUSR|S_IWUSR|S_IXUSR
|
|
|
|
|S_IRGRP|S_IWGRP|S_IXGRP
|
|
|
|
);
|
2008-01-16 10:38:21 +00:00
|
|
|
umask(old_mask);
|
2011-01-06 23:09:13 +00:00
|
|
|
// Only user boinc_master and group boinc_project can
|
2010-01-27 07:38:29 +00:00
|
|
|
// access slot directories, to keep authenticators private
|
2010-03-16 09:52:45 +00:00
|
|
|
set_to_project_group(SLOTS_DIR);
|
2006-08-01 12:36:19 +00:00
|
|
|
}
|
2010-01-27 07:38:29 +00:00
|
|
|
|
2006-08-01 16:09:41 +00:00
|
|
|
#endif
|
2007-03-13 19:33:27 +00:00
|
|
|
get_slot_dir(slot, buf, sizeof(buf));
|
2006-06-12 04:05:10 +00:00
|
|
|
int retval = boinc_mkdir(buf);
|
2006-08-01 16:09:41 +00:00
|
|
|
#ifndef _WIN32
|
2006-08-01 12:36:19 +00:00
|
|
|
if (g_use_sandbox) {
|
2010-01-27 07:38:29 +00:00
|
|
|
old_mask = umask(2);
|
2011-01-06 23:09:13 +00:00
|
|
|
// Contents of slots directory must be world-readable so BOINC Client can read
|
2010-01-27 07:38:29 +00:00
|
|
|
// files written by projects which have user boinc_project and group boinc_project
|
2006-08-01 12:36:19 +00:00
|
|
|
chmod(buf,
|
2007-12-12 04:52:30 +00:00
|
|
|
S_IRUSR|S_IWUSR|S_IXUSR
|
|
|
|
|S_IRGRP|S_IWGRP|S_IXGRP
|
|
|
|
|S_IROTH|S_IXOTH
|
|
|
|
);
|
2008-01-16 10:38:21 +00:00
|
|
|
umask(old_mask);
|
2006-08-01 12:36:19 +00:00
|
|
|
set_to_project_group(buf);
|
|
|
|
}
|
2006-08-01 16:09:41 +00:00
|
|
|
#endif
|
2006-06-12 04:05:10 +00:00
|
|
|
return retval;
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2002-06-06 18:42:01 +00:00
|
|
|
|
2007-03-15 23:01:51 +00:00
|
|
|
// delete unused stuff in the slots/ directory
|
2005-10-10 03:21:52 +00:00
|
|
|
//
|
|
|
|
void delete_old_slot_dirs() {
|
2007-03-13 19:33:27 +00:00
|
|
|
char filename[1024], path[1024];
|
2005-10-10 03:21:52 +00:00
|
|
|
DIRREF dirp;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
dirp = dir_open(SLOTS_DIR);
|
2005-10-11 01:42:55 +00:00
|
|
|
if (!dirp) return;
|
2005-10-10 03:21:52 +00:00
|
|
|
while (1) {
|
|
|
|
strcpy(filename, "");
|
|
|
|
retval = dir_scan(filename, dirp, sizeof(filename));
|
|
|
|
if (retval) break;
|
2007-06-28 11:10:01 +00:00
|
|
|
snprintf(path, sizeof(path), "%s/%s", SLOTS_DIR, filename);
|
2007-03-15 23:01:51 +00:00
|
|
|
if (is_dir(path)) {
|
2007-06-28 11:10:01 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
char init_data_path[1024];
|
|
|
|
SHMEM_SEG_NAME shmem_seg_name;
|
|
|
|
|
2011-01-06 23:09:13 +00:00
|
|
|
// If BOINC crashes or exits suddenly (e.g., due to
|
|
|
|
// being called with --exit_after_finish) it may leave
|
2007-12-12 04:52:30 +00:00
|
|
|
// orphan shared memory segments in the system.
|
|
|
|
// Clean these up here. (We must do this before deleting the
|
2007-06-28 11:10:01 +00:00
|
|
|
// INIT_DATA_FILE, if any, from each slot directory.)
|
2007-12-12 04:52:30 +00:00
|
|
|
//
|
2007-06-28 11:10:01 +00:00
|
|
|
snprintf(init_data_path, sizeof(init_data_path), "%s/%s", path, INIT_DATA_FILE);
|
|
|
|
shmem_seg_name = ftok(init_data_path, 1);
|
|
|
|
if (shmem_seg_name != -1) {
|
|
|
|
destroy_shmem(shmem_seg_name);
|
|
|
|
}
|
|
|
|
#endif
|
2007-03-15 23:01:51 +00:00
|
|
|
if (!gstate.active_tasks.is_slot_dir_in_use(path)) {
|
2009-05-28 19:26:27 +00:00
|
|
|
client_clean_out_dir(path, "delete old slot dirs");
|
2007-10-09 00:34:38 +00:00
|
|
|
remove_project_owned_dir(path);
|
2007-03-15 23:01:51 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-01-15 19:12:43 +00:00
|
|
|
delete_project_owned_file(path, false);
|
2005-10-10 03:21:52 +00:00
|
|
|
}
|
|
|
|
}
|
2006-12-27 22:24:49 +00:00
|
|
|
dir_close(dirp);
|
2005-10-10 03:21:52 +00:00
|
|
|
}
|
|
|
|
|
2002-09-26 05:57:10 +00:00
|
|
|
void get_account_filename(char* master_url, char* path) {
|
2007-03-13 19:33:27 +00:00
|
|
|
char buf[1024];
|
2002-09-26 05:57:10 +00:00
|
|
|
escape_project_url(master_url, buf);
|
|
|
|
sprintf(path, "account_%s.xml", buf);
|
|
|
|
}
|
|
|
|
|
2005-02-27 20:06:51 +00:00
|
|
|
static bool bad_account_filename(const char* filename) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_INTERNAL_ERROR, "Invalid account filename: %s", filename);
|
2005-02-27 20:06:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// account filenames are of the form
|
|
|
|
// account_URL.xml
|
|
|
|
// where URL is master URL with slashes replaced by underscores
|
|
|
|
//
|
2005-02-16 23:17:43 +00:00
|
|
|
bool is_account_file(const char* filename) {
|
2005-02-27 20:06:51 +00:00
|
|
|
const char* p, *q;
|
|
|
|
p = strstr(filename, "account_");
|
|
|
|
if (p != filename) return false;
|
|
|
|
|
2005-04-12 18:08:51 +00:00
|
|
|
q = filename + strlen("account_");
|
2005-02-27 20:06:51 +00:00
|
|
|
p = strstr(q, ".xml");
|
|
|
|
if (!p) return bad_account_filename(filename);
|
|
|
|
if (p == q) return bad_account_filename(filename);
|
|
|
|
|
|
|
|
q = p + strlen(".xml");
|
|
|
|
if (strlen(q)) return bad_account_filename(filename);
|
|
|
|
return true;
|
2002-09-26 05:57:10 +00:00
|
|
|
}
|
2004-09-06 20:30:22 +00:00
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
// statistics filenames are of the form
|
|
|
|
// statistics_URL.xml
|
|
|
|
// where URL is master URL with slashes replaced by underscores
|
|
|
|
//
|
|
|
|
bool is_statistics_file(const char* filename) {
|
|
|
|
const char* p, *q;
|
|
|
|
p = strstr(filename, "statistics_");
|
|
|
|
if (p != filename) return false;
|
|
|
|
q = filename + strlen("statistics_");
|
|
|
|
|
|
|
|
p = strstr(q, ".");
|
|
|
|
if (!p) return bad_account_filename(filename);
|
|
|
|
if (p == q) return bad_account_filename(filename);
|
|
|
|
|
|
|
|
q = p+1;
|
|
|
|
p = strstr(q, ".xml");
|
|
|
|
if (!p) return bad_account_filename(filename);
|
|
|
|
if (p == q) return bad_account_filename(filename);
|
|
|
|
|
|
|
|
q = p + strlen(".xml");
|
|
|
|
if (strlen(q)) return bad_account_filename(filename);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void get_statistics_filename(char* master_url, char* path) {
|
|
|
|
char buf[256];
|
|
|
|
escape_project_url(master_url, buf);
|
|
|
|
sprintf(path, "statistics_%s.xml", buf);
|
|
|
|
}
|
|
|
|
|
2005-04-06 19:41:31 +00:00
|
|
|
bool is_image_file(const char* filename) {
|
|
|
|
std::string fn = filename;
|
|
|
|
downcase_string(fn);
|
2005-06-06 19:18:01 +00:00
|
|
|
if (ends_with(fn, std::string(".jpg"))) return true;
|
|
|
|
if (ends_with(fn, std::string(".jpeg"))) return true;
|
|
|
|
if (ends_with(fn, std::string(".png"))) return true;
|
2005-04-06 19:41:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2006-12-12 23:32:25 +00:00
|
|
|
void boinc_version_dir(PROJECT& p, VERSION_INFO& vi, char* buf) {
|
2011-01-06 23:09:13 +00:00
|
|
|
char projdir[1024];
|
|
|
|
get_project_dir(&p, projdir, sizeof(projdir));
|
2006-12-12 23:32:25 +00:00
|
|
|
sprintf(buf, "%s/boinc_version_%d_%d_%d", projdir, vi.major, vi.minor, vi.release);
|
2006-12-11 23:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool is_version_dir(char* buf, VERSION_INFO& vi) {
|
|
|
|
int n = sscanf(buf, "boinc_version_%d_%d_%d", &vi.major, &vi.minor, &vi.release);
|
|
|
|
return (n==3);
|
|
|
|
}
|
|
|
|
|