Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a better arg for FINDSTR when using the m,l command in Windows. #887

Merged
merged 6 commits into from
Oct 11, 2018

Conversation

PhilRunninger
Copy link
Member

Fixes #883.

The only reason for the FINDSTR is to remove the extra seven lines of boilerplate that the DIR command thinks you need to know. Instead of "grepping" for the date (in its many different formats), we can more easily look for the filename itself.

Copy link
Contributor

@lifecrisis lifecrisis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the simplicity of this fix.

I noticed, however, that the output for directories is different after this commit. Any way to make sure we're listing the metadata about the directory itself?

@PhilRunninger
Copy link
Member Author

I forgot to check directories. To be honest, what shows in master isn't all that informative either. It'll likely require an if directory ... else ... endif construct, and more than a simple DIR command. Let me play with it a bit more.

@PhilRunninger
Copy link
Member Author

Taking what we get from DIR /q macros:

 Volume in drive C has no label.
 Volume Serial Number is 3C81-BABD

 Directory of C:\Program Files (x86)\Vim\vim81\macros

05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators .
05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators ..
03/28/2016  02:56 PM               124 BUILTIN\Administrators editexisting.vim
05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators hanoi
03/28/2016  02:44 PM               109 BUILTIN\Administrators justify.vim
05/18/2012  07:38 AM               288 BUILTIN\Administrators less.bat
05/18/2012  07:37 AM               588 BUILTIN\Administrators less.sh
03/31/2017  02:47 PM             5,567 BUILTIN\Administrators less.vim
05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators life
02/09/2017  03:16 PM               124 BUILTIN\Administrators matchit.vim
05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators maze
03/28/2016  04:03 PM             1,120 BUILTIN\Administrators README.txt
03/28/2016  03:16 PM               115 BUILTIN\Administrators shellmenu.vim
03/28/2016  03:07 PM               114 BUILTIN\Administrators swapmous.vim
05/26/2018  04:25 PM    <DIR>          BUILTIN\Administrators urm
               9 File(s)          8,149 bytes
               6 Dir(s)  21,076,803,584 bytes free

what do you think of this transformation?

05/26/2018  04:25 PM  <DIR>  BUILTIN\Administrators  macros  [9 File(s) 8,149 bytes,  4 Dir(s)]

@lifecrisis
Copy link
Contributor

That looks fine to me. Can we be sure that the output of this command will remain stable? I'm not so familiar with Windows utilities.

@PhilRunninger
Copy link
Member Author

@lifecrisis, I decided to go with the built-in Vim functions, getfsize, getftime, and so on, to find the same information. The only thing I don't like is the size of 0 for directories, but that's a Windows thing. It's similar to what we currently see in the master branch where size is left blank.

Unfortunately, there is no Vim function equivalent to the DIR command's /Q option, which displays the owner of the file.

Phil Runninger (mac) and others added 3 commits October 5, 2018 08:58
@PhilRunninger PhilRunninger merged commit 6b6cadf into master Oct 11, 2018
@PhilRunninger PhilRunninger deleted the fix_local_issue_on_m-l_#883 branch October 11, 2018 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants