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

Filepath.abspath are directory' path resolving fail fix #638

Merged
merged 3 commits into from
Jul 23, 2019

Conversation

tsuyoshicho
Copy link
Contributor

@tsuyoshicho tsuyoshicho commented Jun 30, 2019

環境 Windows
ターゲットpath D:\data
pwd D:\data\test

の状態で
FIlepath.abspathに、\Data\を入れると D:\Data\test\Data\のようになる
(カレントドライブレターはfinddir他で消えることがあるので...fnamemodifyで直ることを期待した)

これは、\Data\がisdirecotryではあってもfilereadableではないためのようです。
逆に上記の状態で\Data\はisdirectoryで1が返ります。そして手動でfnamemodifyするとフルパスが取れます。

filereadable or isdirectoryが条件でもいいのではないか、と思うのですが、どうでしょうか?
ドキュメントにも

abspath({path}) Vital.System.Filepath.abspath()
Return an absolute path of {path}.
If the {path} is already an absolute path, it return the {path}.
cf. |Vital.System.Filepath.relpath()|

とあり、pathであってfile、という制限ではないように読めました。

関数

function! s:abspath(path) abort
  if s:is_absolute(a:path)
    return a:path
  endif
  " Note:
  "   the behavior of ':p' for non existing file path is not defined
  return filereadable(a:path)
        \ ? fnamemodify(a:path, ':p')
        \ : s:join(fnamemodify(getcwd(), ':p'), a:path)
endfunction

テスト用

:echo isdirectory('\Data\')
:echo filereadable('\Data\')

@tsuyoshicho tsuyoshicho changed the title FIlepath.abspath are directory' path resolving fail(?) Filepath.abspath are directory' path resolving fail fix Jun 30, 2019
@ujihisa ujihisa requested review from thinca and tyru July 20, 2019 17:01
@ujihisa
Copy link
Member

ujihisa commented Jul 20, 2019

Assigned the reviewers to the maintainers

@tyru
Copy link
Member

tyru commented Jul 20, 2019

@tsuyoshicho maser を merge するか rebase してもらえますか?

@tsuyoshicho
Copy link
Contributor Author

了解です。

@tsuyoshicho tsuyoshicho force-pushed the fix/filepath-dir branch 2 times, most recently from 03ab5a4 to 732b120 Compare July 21, 2019 04:08
@tsuyoshicho
Copy link
Contributor Author

tsuyoshicho commented Jul 21, 2019

やっぱり、なんかreviewdogのtokenでだめですね...

@tyru
Copy link
Member

tyru commented Jul 22, 2019

以前 #610 で token の再生成を行った記憶があるんですが、やり方を失念してしまった…
#610 でもとりあえず訳も分からず再生成したので、原因とか分かりますかね? (cc: @haya14busa)

http://droneio.haya14busa.com/ からログインしようとしたら

Unable to login. Registration is closed.

って出てログインできませんでした。

@tyru
Copy link
Member

tyru commented Jul 22, 2019

github が不調だったのでそのせいかもですが、復帰した今も同じ症状です。

@tyru tyru mentioned this pull request Jul 23, 2019
@tyru
Copy link
Member

tyru commented Jul 23, 2019

なんかよくわからんけど push したら直ったようで良かったです(こなみ)
とりあえず issue だけ立てておきました。 #684
この PR はマージしちゃいます。

@tyru tyru merged commit 923927e into vim-jp:master Jul 23, 2019
@haya14busa
Copy link
Member

droneio はもう使ってないので全く関係ないです。 401 Bad credentials がでるのは謎です。
正確に言うとreviewdogのトークンではなく後ろで取得したGitHub API token がなぜかGitHub APIから401にランダムに弾かれてるのでreviewdogトークンを再生成しても意味はありません。

@tyru
Copy link
Member

tyru commented Jul 25, 2019

なるほど… つらそう…
とするとどうすればいいんでしょう…
ひたすら空の commit を push して re-run させる?

@tsuyoshicho
Copy link
Contributor Author

GitHub APIのアクセス制限の類なのでしょうか...?

@tsuyoshicho tsuyoshicho deleted the fix/filepath-dir branch July 25, 2019 13:43
@tyru
Copy link
Member

tyru commented Jul 25, 2019

@vim-jp/vim-vimlparser
https://github.com/vim-jp/vital.vim/settings/hooks から drone.io のやつ消しちゃいますね (土日とかに)

@mattn
Copy link
Member

mattn commented Jul 27, 2019

OK です。

@tyru
Copy link
Member

tyru commented Jul 27, 2019

消しました(忘れてた)

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.

5 participants