本文整理汇总了C++中build_path函数的典型用法代码示例。如果您正苦于以下问题:C++ build_path函数的具体用法?C++ build_path怎么用?C++ build_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build_path
// rtl_init - initialise rtl controller
bool Copter::ModeRTL::init(bool ignore_checks)
{
// initialise waypoint and spline controller
wp_nav->wp_and_spline_init();
build_path(!copter.failsafe.terrain);
climb_start();
return true;
}
示例2: g_getenv
std::string AppDirs::get_dirs_config_file(const std::string& dirs_config_file) const
{
if(!dirs_config_file.empty())
return dirs_config_file;
const gchar * conf_file_env = g_getenv("STARDICT_DIRS_CONFIG_FILE");
if(conf_file_env)
return conf_file_env;
return build_path(get_default_user_config_dir(), "stardict-dirs.cfg");
}
示例3: build_path
// re-start RTL with terrain following disabled
void Copter::ModeRTL::restart_without_terrain()
{
AP::logger().Write_Error(LogErrorSubsystem::NAVIGATION, LogErrorCode::RESTARTED_RTL);
if (rtl_path.terrain_used) {
build_path(false);
climb_start();
gcs().send_text(MAV_SEVERITY_CRITICAL,"Restarting RTL - Terrain data missing");
}
}
示例4: context_allowed
/*----------------------------------------------------------------------
Check to see if user is allowed to read or write this folder.
Args: s -- the name to check
Result: Returns 1 if OK
Returns 0 and posts an error message if access is denied
----*/
int
context_allowed(char *s)
{
struct variable *vars = ps_global ? ps_global->vars : NULL;
int retval = 1;
MAILSTREAM stream; /* fake stream for error message in mm_notify */
if(ps_global
&& ps_global->restricted
&& (strindex("./~", s[0]) || srchstr(s, "/../"))){
stream.mailbox = s;
mm_notify(&stream, "Restricted mode doesn't allow operation", WARN);
retval = 0;
}
else if(vars && VAR_OPER_DIR
&& s[0] != '{' && !(s[0] == '*' && s[1] == '{')
&& strucmp(s,ps_global->inbox_name) != 0
&& strcmp(s, ps_global->VAR_INBOX_PATH) != 0){
char *p, *free_this = NULL;
p = s;
if(strindex(s, '~')){
p = strindex(s, '~');
free_this = (char *)fs_get(strlen(p) + 200);
strncpy(free_this, p, strlen(p)+200);
fnexpand(free_this, strlen(p)+200);
p = free_this;
}
else if(p[0] != '/'){ /* add home dir to relative paths */
free_this = p = (char *)fs_get(strlen(s)
+ strlen(ps_global->home_dir) + 2);
build_path(p, ps_global->home_dir, s,
strlen(s)+strlen(ps_global->home_dir)+2);
}
if(!in_dir(VAR_OPER_DIR, p)){
char err[200];
/* TRANSLATORS: User is restricted to operating within a certain directory */
snprintf(err, sizeof(err), _("Not allowed outside of %.150s"), VAR_OPER_DIR);
stream.mailbox = p;
mm_notify(&stream, err, WARN);
retval = 0;
}
else if(srchstr(p, "/../")){ /* check for .. in path */
stream.mailbox = p;
mm_notify(&stream, "\"..\" not allowed in name", WARN);
retval = 0;
}
if(free_this)
fs_give((void **)&free_this);
}
return retval;
}
示例5: build_path
// re-start RTL with terrain following disabled
void Copter::ModeRTL::restart_without_terrain()
{
// log an error
copter.Log_Write_Error(ERROR_SUBSYSTEM_NAVIGATION, ERROR_CODE_RESTARTED_RTL);
if (rtl_path.terrain_used) {
build_path(false);
climb_start();
gcs().send_text(MAV_SEVERITY_CRITICAL,"Restarting RTL - Terrain data missing");
}
}
示例6: get_adb_usb_ini
/* fills buff with the path to the adb vendor id file. returns 0 if success */
int get_adb_usb_ini(char* buff, size_t len)
{
#ifdef _WIN32
const char* home = getenv("ANDROID_SDK_HOME");
if (home != NULL) {
return build_path(buff, len, "%s\\%s\\%s", home);
} else {
char path[MAX_PATH];
SHGetFolderPath( NULL, CSIDL_PROFILE, NULL, 0, path);
return build_path(buff, len, "%s\\%s\\%s", path);
}
#else
const char* home = getenv("HOME");
if (home == NULL)
home = "/tmp";
return build_path(buff, len, "%s/%s/%s", home);
#endif
}
示例7: initialize_pwm
int initialize_pwm(void)
{
if (!BBB_G(pwm_initialized) && load_device_tree("am33xx_pwm")) {
build_path("/sys/devices", "ocp", BBB_G(ocp_dir), sizeof(BBB_G(ocp_dir)));
BBB_G(pwm_initialized) = 1;
return 1;
}
return 0;
}
示例8: _cube_new
static Cube *
_cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
Cube *c;
int i;
w -= (w / 2);
h -= (h / 2);
d -= (d / 2);
c = calloc(1, sizeof(Cube));
for (i = 0; i < 6; i++)
{
Evas_Object *o;
char buf[256];
o = evas_object_image_add(evas);
c->side[i].o = o;
snprintf(buf, sizeof(buf), "im%i.png", (i % 2) + 1);
evas_object_image_file_set(o, build_path(buf), NULL);
evas_object_image_fill_set(o, 0, 0, 720, 420);
evas_object_resize(o, 720, 420);
evas_object_image_smooth_scale_set(o, 0);
evas_object_show(o);
}
POINT(0, 0, -w, -h, -d, 0, 0);
POINT(0, 1, w, -h, -d, 720, 0);
POINT(0, 2, w, h, -d, 720, 420);
POINT(0, 3, -w, h, -d, 0, 420);
POINT(1, 0, w, -h, -d, 0, 0);
POINT(1, 1, w, -h, d, 720, 0);
POINT(1, 2, w, h, d, 720, 420);
POINT(1, 3, w, h, -d, 0, 420);
POINT(2, 0, w, -h, d, 0, 0);
POINT(2, 1, -w, -h, d, 720, 0);
POINT(2, 2, -w, h, d, 720, 420);
POINT(2, 3, w, h, d, 0, 420);
POINT(3, 0, -w, -h, d, 0, 0);
POINT(3, 1, -w, -h, -d, 720, 0);
POINT(3, 2, -w, h, -d, 720, 420);
POINT(3, 3, -w, h, d, 0, 420);
POINT(4, 0, -w, -h, d, 0, 0);
POINT(4, 1, w, -h, d, 720, 0);
POINT(4, 2, w, -h, -d, 720, 420);
POINT(4, 3, -w, -h, -d, 0, 420);
POINT(5, 0, -w, h, -d, 0, 0);
POINT(5, 1, w, h, -d, 720, 0);
POINT(5, 2, w, h, d, 720, 420);
POINT(5, 3, -w, h, d, 0, 420);
return c;
}
示例9: initialize_file
// Initializes values for a file
// @param file a pointer to the file variable
// @param client a pointer to the client variable
// @param p a linked list node with the file
static void initialize_file(file_info *file, client_info *client, csv_record *p) {
file->path = build_path(p, client->dir);
file->file_length = get_file_length(file->path);
file->transfer_threshold = file->file_length * TRANSFER_THRESHOLD_PERCENT;
file->file_count = 0;
file->packets_in_buffer = 0;
file->bytes_sent = 0;
file->file_buffer_size = 0;
} //end initialize_file
示例10: init_cgroups
/* Look for existing cgroups and set up the group_dir array.
Not MT-safe: call before thread setup. */
void
init_cgroups(void) {
cgroup_t group;
DENTER(TOP_LAYER, "init_cgroups");
for (group = (cgroup_t)0; group < cg_num; group++) {
group_dir[group][0] = 0;
if (find_cgroup_dir(group, group_dir[group], SGE_PATH_MAX))
/* special treatment for cpuset */
if (cg_cpuset == group) {
char path[SGE_PATH_MAX], shortbuf[10];
size_t l = sizeof shortbuf;
build_path(path, group_dir[group], "cpuset.mems");
cpuset_prefix = file_exists(path);
if (!cpuset_prefix)
build_path(path, group_dir[group], "mems");
dev_file2string(path, shortbuf, &l);
if (l <= 1) { /* get a newline when it's empty */
WARNING((SGE_EVENT, "Populating "SFN" in " SFN
" so cpusets will work",
cpuset_prefix ? "cpuset.mems" : "mems",
group_dir[group]));
copy_from_parent (group_dir[group], "mems");
}
build_path(path, group_dir[group],
cpuset_prefix ? "cpuset.cpus" : "cpus");
l = sizeof shortbuf;
dev_file2string(path, shortbuf, &l);
if (l <= 1) {
WARNING((SGE_EVENT, "Populating "SFN" in " SFN
" so cpusets will work",
cpuset_prefix ? "cpuset.mems" : "mems",
group_dir[group]));
copy_from_parent (group_dir[group], "cpus");
}
}
}
initialized = true;
DRETURN_VOID;
}
示例11: DraggableView
SignViewGump::SignViewGump(Configuration *cfg) : DraggableView(cfg)
{
font = new BMPFont();
std::string datadir = GUI::get_gui()->get_data_dir();
std::string imagefile;
std::string path;
build_path(datadir, "images", path);
datadir = path;
build_path(datadir, "gumps", path);
datadir = path;
build_path(datadir, "sign", path);
datadir = path;
build_path(datadir, "sign_font", imagefile);
((BMPFont *)font)->init(imagefile, true);
sign_text = NULL;
}
示例12: build_path
std::string AppConf::get_default_export_filename()
{
std::string exportname;
#ifdef _WIN32
exportname = build_path(conf_dirs->get_data_dir(), "dic.txt");
exportname = rel_path_to_data_dir(exportname);
#else
exportname = g_get_home_dir();
exportname+= G_DIR_SEPARATOR_S "dic.txt";
#endif
return exportname;
}
示例13: build_paths
static void build_paths(MCExecPoint& ep)
{
ep . clear();
MCU_path2std(*sg_chosen_folder);
if (**sg_chosen_files == '"')
{
Meta::itemised_string t_items(sg_chosen_files, ' ', true);
for(unsigned int t_index = 0; t_index < t_items . count(); ++t_index)
{
if (t_index != 0)
ep.appendnewline();
build_path(ep, *sg_chosen_folder, t_items[t_index]);
}
}
else
build_path(ep, *sg_chosen_folder, *sg_chosen_files);
sg_chosen_files . clear();
sg_chosen_folder . clear();
}
示例14: reparent_proc
/* Put PROC (string version of pid) into the controller DIR */
static bool
reparent_proc(const char *proc, char *dir)
{
char path[SGE_PATH_MAX];
pid_t pid = atoi(proc);
if (!pid) return false;
/* Don't fail if the process no longer exists. */
build_path(path, "/proc", proc);
if (!sge_is_directory(path)) return true;
return set_pid_cgroup(pid, dir);
}
示例15: parcours_rep
void parcours_rep (const char *chemin)
{
struct dirent *e;
char path[PATH_MAX];
DIR *d = opendir(chemin);
if (d == NULL) fail();
while ((e = readdir(d))) {
build_path(chemin, e->d_name, path);
liens_symboliques(path);
}
if (errno != 0) fail();
if (closedir(d) == -1) fail();
}