|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | import sys, os, platform, re
|
3 |
| -from pathlib import Path, PureWindowsPath |
| 3 | +from pathlib import Path |
4 | 4 |
|
5 | 5 | import wx
|
6 | 6 | import wx.lib.mixins.inspection
|
@@ -395,6 +395,7 @@ def OnProfDirButton(self, _ = None):
|
395 | 395 | config = wx.ConfigBase.Get()
|
396 | 396 | bindpath = config.Read('BindPath')
|
397 | 397 | separator = "\\" if platform.system() == "Windows" else "/"
|
| 398 | + if bindpath[-1:] == separator: separator = '' |
398 | 399 |
|
399 | 400 | dirSizer = wx.BoxSizer(wx.HORIZONTAL)
|
400 | 401 | dirSizer.Add(wx.StaticText(ProfDirDialog, -1,
|
@@ -443,6 +444,10 @@ def OnProfDirButton(self, _ = None):
|
443 | 444 |
|
444 | 445 | # need this out here in case we cancelled on a previously-blank one.
|
445 | 446 | # This is very very unlikely to happen and awful if it does.
|
| 447 | + # |
| 448 | + # TODO-ish: if they erase an existing valid one or otherwise cause an |
| 449 | + # error, and then hit "cancel" this gets triggered, which is not |
| 450 | + # perfect - this logic needs a little smartening. |
446 | 451 | if PathText.HasErrors(): return self.OnProfDirButton()
|
447 | 452 |
|
448 | 453 | self.CheckProfDirButtonErrors()
|
@@ -501,10 +506,11 @@ def OnPathTextChanged(self, evt):
|
501 | 506 | else:
|
502 | 507 | textctrl.RemoveError('spaces')
|
503 | 508 |
|
504 |
| - if PureWindowsPath(value).is_reserved(): |
505 |
| - textctrl.AddError('reserved', 'The name you have selected is a reserved filename in Windows. Please select another.') |
506 |
| - else: |
507 |
| - textctrl.RemoveError('reserved') |
| 509 | + if platform.system() == 'Windows': |
| 510 | + if os.path.isreserved(value): |
| 511 | + textctrl.AddError('reserved', 'The name you have selected is a reserved filename in Windows. Please select another.') |
| 512 | + else: |
| 513 | + textctrl.RemoveError('reserved') |
508 | 514 |
|
509 | 515 | if value: # don't do this check if it's blank
|
510 | 516 | exists = None
|
|
0 commit comments