2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 02:50:24 +01:00
|
|
|
* limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __UTIL_PATH_H__
|
|
|
|
|
#define __UTIL_PATH_H__
|
|
|
|
|
|
|
|
|
|
/* Utility functions to get paths to files distributed with the program. For
|
|
|
|
|
* the standalone apps, paths are relative to the executable, for dynamically
|
|
|
|
|
* linked libraries, the path to the library may be set with path_init, which
|
|
|
|
|
* then makes all paths relative to that. */
|
|
|
|
|
|
2014-01-11 00:47:58 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 20:39:14 +02:00
|
|
|
#include "util/util_set.h"
|
|
|
|
|
#include "util/util_string.h"
|
|
|
|
|
#include "util/util_types.h"
|
|
|
|
|
#include "util/util_vector.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
2014-01-23 01:13:09 +01:00
|
|
|
/* program paths */
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
void path_init(const string &path = "", const string &user_path = "", const string &tmp_path = "");
|
2011-04-27 11:58:34 +00:00
|
|
|
string path_get(const string &sub = "");
|
2011-09-09 12:04:39 +00:00
|
|
|
string path_user_get(const string &sub = "");
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
string path_temp_get(const string &sub = "");
|
2016-09-05 16:41:08 +02:00
|
|
|
string path_cache_get(const string &sub = "");
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-01-23 01:13:09 +01:00
|
|
|
/* path string manipulation */
|
2011-04-27 11:58:34 +00:00
|
|
|
string path_filename(const string &path);
|
|
|
|
|
string path_dirname(const string &path);
|
|
|
|
|
string path_join(const string &dir, const string &file);
|
2011-09-08 18:58:07 +00:00
|
|
|
string path_escape(const string &path);
|
2014-03-21 17:22:41 +01:00
|
|
|
bool path_is_relative(const string &path);
|
2014-01-23 01:13:09 +01:00
|
|
|
|
|
|
|
|
/* file info */
|
2016-02-05 09:09:39 +01:00
|
|
|
size_t path_file_size(const string &path);
|
2011-09-08 18:58:07 +00:00
|
|
|
bool path_exists(const string &path);
|
2016-02-05 09:09:39 +01:00
|
|
|
bool path_is_directory(const string &path);
|
2011-09-03 10:49:54 +00:00
|
|
|
string path_files_md5_hash(const string &dir);
|
2014-01-23 01:13:09 +01:00
|
|
|
uint64_t path_modified_time(const string &path);
|
2011-09-03 10:49:54 +00:00
|
|
|
|
2014-01-23 01:13:09 +01:00
|
|
|
/* directory utility */
|
2011-09-12 13:13:56 +00:00
|
|
|
void path_create_directories(const string &path);
|
2014-01-23 01:13:09 +01:00
|
|
|
|
|
|
|
|
/* file read/write utilities */
|
|
|
|
|
FILE *path_fopen(const string &path, const string &mode);
|
|
|
|
|
|
2011-09-09 12:04:39 +00:00
|
|
|
bool path_write_binary(const string &path, const vector<uint8_t> &binary);
|
2013-05-27 16:21:07 +00:00
|
|
|
bool path_write_text(const string &path, string &text);
|
2011-09-09 12:04:39 +00:00
|
|
|
bool path_read_binary(const string &path, vector<uint8_t> &binary);
|
2012-11-03 14:32:35 +00:00
|
|
|
bool path_read_text(const string &path, string &text);
|
|
|
|
|
|
2016-02-05 09:09:39 +01:00
|
|
|
/* File manipulation. */
|
|
|
|
|
bool path_remove(const string &path);
|
|
|
|
|
|
2014-01-23 01:13:09 +01:00
|
|
|
/* cache utility */
|
|
|
|
|
void path_cache_clear_except(const string &name, const set<string> &except);
|
2014-01-11 00:47:58 +01:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif
|