diff --git a/command_prompt.py b/command_prompt.py index f935a8c..23342dc 100644 --- a/command_prompt.py +++ b/command_prompt.py @@ -4,8 +4,6 @@ from kivy.graphics import Color,Rectangle import glob import os.path -from tools import common_substr - class Command_prompt(Label): def __init__(self,app,**kwargs): @@ -272,4 +270,4 @@ class Command_prompt(Label): name="\""+name+"\"" self.app.status_bar.raw_text+=name+" " self.app.status_bar.draw() - return common_substr(paths)[end:] + return os.path.commonprefix(paths)[end:] diff --git a/tools.py b/tools.py index 06e36a0..a9ef4e9 100644 --- a/tools.py +++ b/tools.py @@ -9,16 +9,3 @@ def isint_nonzero(x): if abs(x)<1e-11: return False return abs(round(x)-x)<1e-11 - -# find the common substring in a list of strings -def common_substr(strings): - out="" - if len(strings)==0: - return out - for i in range(len(strings[0])): - for j in range(1,len(strings)): - if strings[j][i]!=strings[0][i]: - return out - out+=strings[0][i] - - return out