Skip to content

Commit f144c72

Browse files
authored
switch from AMPAS_DATA_PATH to RAWTOACES_DATA_PATH environment variable (#156)
switch from AMPAS_DATA_PATH to RAWTOACES_DATA_PATH Signed-off-by: Anton Dukhovnikov <[email protected]>
1 parent 3c3b5d1 commit f144c72

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ By default, `rawtoaces` will determine the adopted white by finding the set of w
242242

243243
$ rawtoaces --wb-method 1 D60 --mat-method 0 input.raw
244244

245-
You can use the environment varilable of `AMPAS_DATA_PATH` to specify the repository for your own datasets. If you have spectral sensitivity data for your camera but it is not included with `rawtoaces` you may place that data in `/usr/local/include/rawtoaces/data/camera` or place the data in the folder pointed by `AMPAS_DATA_PATH`.
245+
You can use the environment variable of `RAWTOACES_DATA_PATH` to specify the repository for your own datasets. If you have spectral sensitivity data for your camera but it is not included with `rawtoaces` you may place that data in `/usr/local/include/rawtoaces/data/camera` or place the data in the folder pointed by `RAWTOACES_DATA_PATH`. The rawtoaces versions prior to v1.1 used the environment variable `AMPAS_DATA_PATH`, the old name is still supported for backward compatibility. If both variables are present, `RAWTOACES_DATA_PATH` takes priority.
246246

247247

248248
#### Spectral Datasets

include/rawtoaces/define.h

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <string>
5858
#include <algorithm>
5959
#include <boost/filesystem.hpp>
60+
#include <iostream>
6061

6162
#ifndef WIN32
6263
# include <sys/stat.h>
@@ -343,10 +344,14 @@ inline vector<string> openDir( string path = "." )
343344
{
344345
vector<string> paths;
345346

346-
for ( auto &i: boost::filesystem::directory_iterator( path ) )
347+
if ( boost::filesystem::exists( path ) )
347348
{
348-
if ( i.status().type() != boost::filesystem::file_type::directory_file )
349-
paths.push_back( i.path().string() );
349+
for ( auto &i: boost::filesystem::directory_iterator( path ) )
350+
{
351+
if ( i.status().type() !=
352+
boost::filesystem::file_type::directory_file )
353+
paths.push_back( i.path().string() );
354+
}
350355
}
351356

352357
return paths;
@@ -448,7 +453,20 @@ inline dataPath &pathsFinder()
448453
const char *env;
449454

450455
vector<string> &PATHs = cdp.paths;
451-
env = getenv( "AMPAS_DATA_PATH" );
456+
457+
env = getenv( "RAWTOACES_DATA_PATH" );
458+
if ( !env )
459+
{
460+
// Fallback to the old environment variable.
461+
env = getenv( "AMPAS_DATA_PATH" );
462+
463+
if ( env )
464+
{
465+
std::cerr << "Warning: The environment variable "
466+
<< "AMPAS_DATA_PATH is now deprecated. Please use "
467+
<< "RAWTOACES_DATA_PATH instead." << std::endl;
468+
}
469+
}
452470

453471
if ( env )
454472
path = env;

src/rawtoaces_util/acesrender.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void usage( const char *prog )
9797
" 3=Average a grey box for white balance <x y w h>\n"
9898
" 4=Use custom white balance <r g b g>\n"
9999
" (default = 0)\n"
100-
" --mat-method [0-2] IDT matrix calculation method\n"
100+
" --mat-method [0-3] IDT matrix calculation method\n"
101101
" 0=Calculate matrix from camera spec sens\n"
102102
" 1=Use file metadata color matrix\n"
103103
" 2=Use adobe coeffs included in libraw\n"
@@ -876,7 +876,7 @@ int AcesRender::unpack( const char *pathToRaw )
876876
// inputs:
877877
// const char * : camera spectral sensitivity path
878878
// (either in the environment variable of
879-
// "AMPAS_CAMERA_SENSITIVITIES_PATH"
879+
// "${RAWTOACES_DATA_PATH}/camera"
880880
// such as "/usr/local/include/rawtoaces/data/camera"
881881
// or specified by users)
882882
// libraw_iparams_t : main parameters read from RAW
@@ -916,8 +916,9 @@ int AcesRender::fetchCameraSenPath( const libraw_iparams_t &P )
916916
//
917917
// inputs:
918918
// const char * : type of light source ("unknown" if not specified)
919-
// (in the environment variable of "AMPAS_ILLUMINANT_PATH"
920-
// such as "/usr/local/include/rawtoaces/data/Illuminant")
919+
// (in the environment variable of
920+
// "${RAWTOACES_DATA_PATH}/illuminant" such as
921+
// "/usr/local/include/rawtoaces/data/illuminant")
921922
//
922923
// outputs:
923924
// int : "1" means loading/injecting light source datasets successfully,

0 commit comments

Comments
 (0)