Skip to content

Commit d55e8cb

Browse files
committed
Simplify _get_data_paths
1 parent cdda973 commit d55e8cb

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

proplot/styletools.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,17 +2719,14 @@ def inverse(self, yq, clip=None):
27192719

27202720

27212721
def _get_data_paths(dirname):
2722-
"""Returns configuration file paths."""
2723-
# Home configuration
2724-
paths = []
2725-
ipath = os.path.join(os.path.expanduser('~'), '.proplot', dirname)
2726-
if os.path.exists(ipath) and ipath not in paths:
2727-
paths.insert(0, ipath)
2728-
# Global configuration
2729-
ipath = os.path.join(os.path.dirname(__file__), dirname)
2730-
if ipath not in paths:
2731-
paths.insert(0, ipath)
2732-
return paths
2722+
"""Return data folder paths in reverse order of precedence."""
2723+
# When loading colormaps, cycles, and colors, files in the latter
2724+
# directories overwrite files in the former directories. When loading
2725+
# fonts, the resulting paths need to be *reversed*.
2726+
return [
2727+
os.path.join(os.path.dirname(__file__), dirname),
2728+
os.path.join(os.path.expanduser('~'), '.proplot', dirname)
2729+
]
27332730

27342731

27352732
def _load_cmap_cycle(filename, cmap=False):

0 commit comments

Comments
 (0)