Open kloneets opened 8 years ago
Ok, I looked closer to code and se, that trimming is performed afterwords with javascript, so, line could be just:
'df | grep ' + drive + ' | grep -oh \' /.*\''
Yeah. I've run into this as well. (Check out my fork.) I switched it with this: 'df -kl | grep ' + drive + ' | awk \'{ for (i = 9; i <= NF; i++) print $i}\' ORS=\' \'' Not the best because it assumes that the 9th is the beginning of the mount point. What if the first parameter has a space in it? What does yours do?
Mine just finds row with drive and asumes that
Does that get "/Volumes/some drive"?
In my case it did :D
A case where that would fail is if the mount point folder has a trailing space ('/Volumes /some drive'). I think that's less possible than the first field having a space in it. So, it's a better solution than mine. Do you know if it's possible?
Never saw such mountpoint naming, but users are geniuses and, if someone allows to do this, they will :D I just tested on my mac (el capitan) and my solution worked on flahsdrive called " My flash " (space before "My" and after "flash"). So - need to be tested on other platforms :)
If, for example, my drive name would be
some data
, then nodejs-disks interprets mount point as/Volumes/some
. This happens because mount point searching algorithm prints with awk 6th parameter. I suggest (it is my quick and dirty hack because I do not know awk) replacing this line'df | grep ' + drive + ' | awk \'{print $6}\''
with this'df | grep ' + drive + ' | grep -oh \' /.*\' | grep -oh \'/.*\''