mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
use os and os.path
This commit is contained in:
parent
bf1710ac5f
commit
aa257d90da
2 changed files with 6 additions and 20 deletions
|
@ -2,14 +2,7 @@
|
||||||
|
|
||||||
# XXX Displays messy paths when following '..'
|
# XXX Displays messy paths when following '..'
|
||||||
|
|
||||||
try:
|
import os
|
||||||
import posix, path
|
|
||||||
os = posix
|
|
||||||
except ImportError:
|
|
||||||
import mac, macpath
|
|
||||||
os = mac
|
|
||||||
path = macpath
|
|
||||||
|
|
||||||
import stdwin, rect
|
import stdwin, rect
|
||||||
from stdwinevents import *
|
from stdwinevents import *
|
||||||
from Buttons import PushButton
|
from Buttons import PushButton
|
||||||
|
@ -22,8 +15,8 @@ class DirList(VSplit):
|
||||||
self = VSplit.create(self, parent)
|
self = VSplit.create(self, parent)
|
||||||
names = os.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
for name in names:
|
for name in names:
|
||||||
if path.isdir(path.join(dirname, name)):
|
if os.path.isdir(os.path.join(dirname, name)):
|
||||||
fullname = path.join(dirname, name)
|
fullname = os.path.join(dirname, name)
|
||||||
btn = SubdirButton().definetext(self, fullname)
|
btn = SubdirButton().definetext(self, fullname)
|
||||||
elif name[-3:] == '.py':
|
elif name[-3:] == '.py':
|
||||||
btn = ModuleButton().definetext(self, name)
|
btn = ModuleButton().definetext(self, name)
|
||||||
|
|
|
@ -2,14 +2,7 @@
|
||||||
|
|
||||||
# XXX Displays messy paths when following '..'
|
# XXX Displays messy paths when following '..'
|
||||||
|
|
||||||
try:
|
import os
|
||||||
import posix, path
|
|
||||||
os = posix
|
|
||||||
except ImportError:
|
|
||||||
import mac, macpath
|
|
||||||
os = mac
|
|
||||||
path = macpath
|
|
||||||
|
|
||||||
import stdwin, rect
|
import stdwin, rect
|
||||||
from stdwinevents import *
|
from stdwinevents import *
|
||||||
from Buttons import PushButton
|
from Buttons import PushButton
|
||||||
|
@ -22,8 +15,8 @@ class DirList(VSplit):
|
||||||
self = VSplit.create(self, parent)
|
self = VSplit.create(self, parent)
|
||||||
names = os.listdir(dirname)
|
names = os.listdir(dirname)
|
||||||
for name in names:
|
for name in names:
|
||||||
if path.isdir(path.join(dirname, name)):
|
if os.path.isdir(os.path.join(dirname, name)):
|
||||||
fullname = path.join(dirname, name)
|
fullname = os.path.join(dirname, name)
|
||||||
btn = SubdirButton().definetext(self, fullname)
|
btn = SubdirButton().definetext(self, fullname)
|
||||||
elif name[-3:] == '.py':
|
elif name[-3:] == '.py':
|
||||||
btn = ModuleButton().definetext(self, name)
|
btn = ModuleButton().definetext(self, name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue