andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 39 forks source link

Unresposive for a bit when file is opened from outside Enki #393

Closed richbowen closed 8 years ago

richbowen commented 8 years ago

The default folder when opening files from outside Enki (ie. opening a file from Windows Explorer) seems to be C:\Windows\System32.The implication of this is that Enki is unresponsive for a while when opening a file from outside of explorer or launching Enki with it in the System32 directory.

Illustration: Fig 1. ohjhgoknkk

andreikop commented 8 years ago

If you navigate file browser to some other path then close and open Enki, does it open in System32 again?

richbowen commented 8 years ago

No changing directory, closing and then reopening Enki doesn't reopen System32, it stays on the directory.

nqhnnk4vs7

andreikop commented 8 years ago

It seems like the lag happens when FileBrowser loads too many files. It is quite difficult to fix and it won't happen often, because directories with sources doesn't contain so many files.

richbowen commented 8 years ago

I think setting the default directory when opening files from outside Enki to %HOMEPATH% instead of %SYSTEMROOT%\System32 (C:\Windows\System32) because it seems to loads less stuff. It loads faster than C:\Windows\System32 and it's easier to navigate from %HOMEPATH% to desired directory than it is from C:\Windows\System32.

bjones1 commented 8 years ago

Hmmm. Are you running from source or from the WIndows binary? What version?

richbowen commented 8 years ago

Was running from the Windows binary. Enki version 15.11.1.

richbowen commented 8 years ago

I think this is the relevant code that needs modification. I think the following modifications would do the trick:

if not sys.platform.startswith('win'):
    self._dirsModel.setRootPath(os.path.expanduser("~/")) # unix based systems
else:
    self._dirsModel.setRootPath(os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']) # windows

or something more robust.

I haven't tested it so I don't know if it works or not.