Skip to content
Snippets Groups Projects
Commit df2666e0 authored by jmcchesn's avatar jmcchesn
Browse files

Update iexcode/instruments/AD_utilities.py

parent 72c9f0b9
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,7 @@ work in progress need to redo
##############################################################################################################
import datetime
import re
from os import listdir,mkdir,chown,system,chmod
from os.path import join, isfile, exists, dirname
from os import listdir,mkdir,chown,system,chmod,path
from time import sleep
from epics import caget, caput
......@@ -35,7 +34,7 @@ def AD_CurrentDirectory(ADplugin):
else:
Dir = SubDir
SubDir=[]
FilePath=join(Dir,*SubDir,'')
FilePath=path.join(Dir,*SubDir,'')
return FilePath
def AD_prefix(ADplugin):
......@@ -74,7 +73,8 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs):
FileTemplate="%s%s_%4.4d."+ext; format for filename first %s = filepath, second %s = prefix
"""
kwargs.setdefault("userpath",dirname(mda.filepath()))
fp=path.dirname(mda.filepath())
kwargs.setdefault("userpath",fp)
kwargs.setdefault("subfolder",ADplugin.split(":")[-2][:-1])
kwargs.setdefault("prefix",ADplugin.split(":")[-2][:-1])
......@@ -87,9 +87,9 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs):
if kwargs['debug']:
print("kwargs: ",kwargs)
fpath=join(kwargs['userpath'],kwargs['subfolder'],'')
fpath=path.join(kwargs['userpath'],kwargs['subfolder'],'')
print("\nFolder: " + fpath)
if not (exists(fpath)):
if not (path.exists(fpath)):
fileNumber=1
else:
fileNumber=get_next_fileNumber(fpath,kwargs["prefix"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment