File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 2222# specific language governing permissions and limitations
2323# under the License.
2424import os
25-
25+ import sys
26+ from osbenchmark .utils .io import ensure_dir
2627
2728def benchmark_confdir ():
2829 default_home = os .path .expanduser ("~" )
2930 old_path = os .path .join (default_home , ".benchmark" )
3031 new_path = os .path .join (default_home , ".osb" )
3132
32- # Create .benchmark directory if it doesn't exist
33- if not os .path .exists (old_path ):
34- os .makedirs (old_path , exist_ok = True )
35-
36- # Create .osb directory if it doesn't exist
37- if not os .path .exists (new_path ):
38- os .makedirs (new_path , exist_ok = True )
33+ # ensure both directories exist
34+ ensure_dir (old_path )
35+ ensure_dir (new_path )
3936
4037 # Create symlink from .osb to .benchmark if it doesn't exist
4138 if not os .path .islink (new_path ):
4239 try :
4340 os .symlink (old_path , new_path , target_is_directory = True )
44- except OSError :
45- print (f"Warning: Failed to create symlink from { new_path } to { old_path } " )
41+ except OSError as e :
42+ error_message = (
43+ f"OSError: Failed to create symlink from { new_path } to { old_path } \n "
44+ f"Error type: { type (e ).__name__ } \n "
45+ f"Error message: { str (e )} \n "
46+ )
47+ print (error_message , file = sys .stderr )
4648
4749 return os .path .join (os .getenv ("BENCHMARK_HOME" , default_home ), ".osb" )
4850
You can’t perform that action at this time.
0 commit comments