我应该在哪里生成 Windows 终端 JSON 片段扩展?

Where should I generate Windows Terminal JSON fragment extensions?

我正在我的代码中为 Windows 终端创建“JSON 片段扩展”,以创建一些“自动生成的”Windows 终端配置文件。

在官方文档 JSON fragment extensions in Windows Terminal 中,推荐了 2 个用于存储片段的位置(如果您的应用程序不是 Microsoft Store 应用程序):

For applications installed from the web, there are 2 cases. The first is that the installation is for all the users on the system. In this case, the JSON files should be added to the folder:

C:\ProgramData\Microsoft\Windows Terminal\Fragments\{app-name}\{file-name}.json

In the second case, the installation is only for the current user. In this case, the JSON files should be added to the folder:

C:\Users\<user>\AppData\Local\Microsoft\Windows Terminal\Fragments\{app-name}\{file-name}.json

这看起来很简单,但是 some other documentation 描述了实际的 settings.json 文件位置:

The path for your Windows Terminal settings.json file may be found in one of the following directories:

  • Terminal (stable / general release): %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
  • Terminal (preview release): %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState\settings.json
  • Terminal (unpackaged: Scoop, Chocolately, etc): %LOCALAPPDATA%\Microsoft\Windows Terminal\settings.json

所以,明确地说,如果我正在创建配置文件片段文件,这些路径并不重要,对吧?我不需要为片段文件选择不同的路径(%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe vs %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe vs %LOCALAPPDATA%\Microsoft\Windows Terminal 因为片段总是从加载C:\Users\<user>\AppData\Local\Microsoft\Windows Terminal\Fragments 等等?

So, to be clear, these paths are not important if I'm creating profile fragment files, right?

正确! Terminal 查找片段文件的位置 well-defined 并且在不同版本中持久。