summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/IOBinding.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/IOBinding.py')
-rw-r--r--Lib/idlelib/IOBinding.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index cd2638c..e207750 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -179,12 +179,18 @@ class IOBinding:
self.filename_change_hook = hook
filename = None
+ dirname = None
def set_filename(self, filename):
- self.filename = filename
- self.set_saved(1)
- if self.filename_change_hook:
- self.filename_change_hook()
+ if filename and os.path.isdir(filename):
+ self.filename = None
+ self.dirname = filename
+ else:
+ self.filename = filename
+ self.dirname = None
+ self.set_saved(1)
+ if self.filename_change_hook:
+ self.filename_change_hook()
def open(self, event=None, editFile=None):
if self.editwin.flist:
@@ -505,6 +511,8 @@ class IOBinding:
def defaultfilename(self, mode="open"):
if self.filename:
return os.path.split(self.filename)
+ elif self.dirname:
+ return self.dirname, ""
else:
try:
pwd = os.getcwd()