The following lisp code advices
ffap-string-at-point such that it returns the string text at point if point is inside a string.
That modification lets
find-file-at-point propose the full string text as initial input for the file name.
MS-Windows file names with drive letters are wrongly detected as url's if the value of the variable
ffap-lax-url is non-nil. In that case
c:/Program as initial input if point is within
Program of the string
"c:/Program Files". So it may be that you need to set
ffap-lax-url to nil.
The advice relies on the syntax parser (
syntax-ppss) of emacs. That works on all major modes with syntactic fontification.
(require 'subr-x) ;; for `when-let'
;; You can also use `thingatpt+.el' instead.
(defun bounds-of-string-at-point ()
"String at point including the string delimiters."
(when-let ((ppss (syntax-ppss))
(in-string (nth 3 ppss))
(b (nth 8 ppss))
(e-ppss (save-excursion (parse-partial-sexp (1+ b) (point-max) nil nil nil 'syntax-table)))
(e (1+ (nth 8 e-ppss))))
(cons b e)))
(put 'string 'bounds-of-thing-at-point #'bounds-of-string-at-point)
(defun around-ad-ffap-string-at-point (oldfun &optional mode)
"Use the string at point for `ffap-string-at-point'
or the original function if we are not within a string."
(let ((str-bounds (bounds-of-thing-at-point 'string)))
(setcar ffap-string-at-point-region (1+ (car str-bounds)))
(setcar (cdr ffap-string-at-point-region) (1- (cdr str-bounds)))))
(funcall oldfun mode))))
(advice-add 'ffap-string-at-point :around #'around-ad-ffap-string-at-point)