Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/694305e8-d7f8-800e-a8d8-fbf410be6545
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: 結論から言うね。 === 結論から言うね。 ==== : ==== ただし 万能ではない。 ==== Windows内部(Win32 API)では: ==== * <code>/</code> と <code>\</code> を同一視する処理が多い * パス正規化の段階で \ に変換される だから: <syntaxhighlight lang="text">C:/Windows/System32 </syntaxhighlight> は <syntaxhighlight lang="text">C:\Windows\System32 </syntaxhighlight> として扱われることが多い。 ==== ### ==== * 多くの Win32 API * .NET(C#, PowerShell) * Java * Python(Windows上) * Git / Node.js / npm * CMake などのビルドツール 例(Python): <syntaxhighlight lang="python">open("C:/Windows/System32/drivers/etc/hosts") </syntaxhighlight> ==== ### ==== <syntaxhighlight lang="bat">dir C:/Windows </syntaxhighlight> * / が オプション開始として解釈されることがある ===== - 自前パーサ ===== * DOS時代互換 * 業務ソフト ===== <syntaxhighlight lang="text">//server/share ← ダメ ===== \\server\share ← 正解 </syntaxhighlight> UNC は / 不可。 ==== - 文字列リテラルの話 ==== * OSのパスではない <syntaxhighlight lang="java">"C:\\Windows\\System32" </syntaxhighlight> 👉 プログラム内表記の問題 ==== : ==== ==== | | | ==== | --- | --- | | | | | | | | | | | | | | | | ==== - C:/... は 実務では普通に通用 ==== * ただし cmd / UNC / 古いツールは例外 * 「絶対安全」ではない ===== : ===== 必要なら * 言語別の完全可否表 * cmdで壊れる具体例 * なぜWinが / を許したのか どこまで掘る?
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)