From 7c37a0f71c70ecc73314545b5b973a5a9fbb5619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Fri, 17 May 2019 17:30:47 +0200 Subject: [PATCH] forgotten file --- src/caosadvancedtools/utils.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/caosadvancedtools/utils.py diff --git a/src/caosadvancedtools/utils.py b/src/caosadvancedtools/utils.py new file mode 100644 index 00000000..b86c32a2 --- /dev/null +++ b/src/caosadvancedtools/utils.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# encoding: utf-8 +# +# ** header v3.0 +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2019 Henrik tom Wörden +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +# ** end header +# + +import os + + +def replace_path_prefix(path, old_prefix, new_prefix): + assert path.startswith(old_prefix) + path = path[len(old_prefix):] + + return os.path.join(new_prefix, path) -- GitLab