Skip to content

Commit

Permalink
AppContext provides a work directory for each application
Browse files Browse the repository at this point in the history
  • Loading branch information
schiebel committed Jan 3, 2024
1 parent bef5cef commit 2cc5f67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions casagui/toolbox/_app_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def __init__( self, title, prefix=None ):
if prefix is None:
## create a prefix from the title
prefix = self._slugify(title)[:10]
self.__tempdir = TemporaryDirectory(prefix=prefix)
self.__htmlpath = join( self.__tempdir.name, f'''{self._slugify(title)}.html''' )
self.__workdir = TemporaryDirectory(prefix=prefix)
self.__htmlpath = join( self.__workdir.name, f'''{self._slugify(title)}.html''' )
output_file( self.__htmlpath, title=title )

def __del__( self ):
### remove work directory and its contents
self.__tempdir.cleanup( )
self.__workdir.cleanup( )

def tempdir( self ):
return self.__tempdir.name
def workdir( self ):
return self.__workdir.name

0 comments on commit 2cc5f67

Please sign in to comment.