def bundle_dir():
if frozen():<EOL><INDENT>directory = sys._MEIPASS<EOL><DEDENT>else:<EOL><INDENT>directory = os.path.dirname(os.path.abspath(stack()[<NUM_LIT:1>][<NUM_LIT:1>]))<EOL><DEDENT>if os.path.exists(directory):<EOL><INDENT>return directory<EOL><DEDENT>
Handle resource management within an executable file.