File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,12 +206,21 @@ function! mdip#MarkdownClipboardImage()
206206 let s: os = substitute (system (' uname' ), ' \n' , ' ' , ' ' )
207207 endif
208208
209- let workdir = s: SafeMakeDir ()
210- " change temp-file-name and image-name
211- let g: mdip_tmpname = s: InputName ()
212- if empty (g: mdip_tmpname )
213- let g: mdip_tmpname = g: mdip_imgname . ' _' . s: RandomName ()
214- endif
209+ " add check whether file with the name exists
210+ while 1
211+ let workdir = s: SafeMakeDir ()
212+ " change temp-file-name and image-name
213+ let g: mdip_tmpname = s: InputName ()
214+ if empty (g: mdip_tmpname )
215+ let g: mdip_tmpname = g: mdip_imgname . ' _' . s: RandomName ()
216+ endif
217+ let testpath = workdir . ' /' . g: mdip_tmpname . ' .png'
218+ if filereadable (testpath) == 0
219+ break
220+ else
221+ echo " \n This file name already exists"
222+ endif
223+ endwhile
215224
216225 let tmpfile = s: SaveFileTMP (workdir, g: mdip_tmpname )
217226 if tmpfile == 1
You can’t perform that action at this time.
0 commit comments