Get Directory of a File Name in Javascript -


How to obtain a file's directory?

For example, I have a string near

  c: \ program files \ nant \ bin \ nant.exe  

I have a function that gives me

  C: \ program files \ nant \ bin  

let me split the string manually and Instead of leaving the last one, there would be a built-in function in the job.

Edit: I'm running on Windows

I do not know that there is any functionality for this, but it is quite easy to get the path.

  path = path.substring (0, path.lastIndexOf ("\") +1);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -