Template:Path: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Properly switch images with {{{2}}} parameter now.)
No edit summary
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Bug|Characters "<" and ">" can break the template partially. Use {{code|<nowiki><nowiki></nowiki>}} as a workaround.{{todo|Remove unnecessary (redundant) tooltip span that does this.}}}}{{Doc}}<includeonly><onlyinclude><!--
{{todo|Fall back to generic file icon instead of folder icon if {{param|2}} is present.}}
--><span title="{{#switch:{{{icon}}}
{{todo|Icons for models, maps, compressed archives, and uncompressed packages. Syntax exists, and just needs to be uncommented when the icons are ready.}}
|#default={{Path/strings|Path}} {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
{{todo|Icons for linked libraries (DLL, SO, DYLIB).}}
|exe|executable={{Path/strings|exe}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
{{todo|Separate designation for compressed vs uncompressed archives.}}
|reg|regedit|registry={{Path/strings|reg}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
{{Documentation}}
|regvalue|regv={{Path/strings|regv}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
<includeonly>
|custom={{Path/strings|File}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}<!-- Currently generic for now -->
 
|audio|sound|music={{Path/strings|Audio}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}<!-- TODO: Automatically change the icon based of file format-->
<onlyinclude><!--
|video|movie={{Path/strings|Video}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
--><span style="display:inline-flex; align-items:center; line-height:1.35em"><!--
|image|picture={{Path/strings|Image}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
--><span style="background-color:{{#ifeq:{{{icon|}}}|reg|rgba(100, 145, 230, 0.1)| {{#ifeq:{{{icon|}}}|regv|rgba(100, 145, 230, 0.1)| {{#if:{{{2|}}}|#984EDD20|rgba(230, 145, 100, 0.1)}} }} }};padding:0 3px 0 4px; user-select:none; pointer-events:none"><!--
|texture={{Path/strings|Textures}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
--><span style="position:relative; top:{{#if:{{{icon|}}}{{{2|}}}|1px|3px}}"><!--
|generic|file={{Path/strings|File}} - {{{1|}}}{{#if:{{{2|}}}|.{{{2}}}|}}
-->[[File:{{#if:{{{icon|}}}
}}" style="display:inline-flex; align-items:center; line-height:1.35em"><!--
      | {{#switch: {{lc:{{{icon}}}}}
--><span style="background-color:{{#if:{{{2|}}}|#984EDDCC|#536FFFCC}}; border-radius:4px 0 0 4px; padding:0 3px 0 4px; user-select:none; pointer-events:none"><!--
 
--><span style="position:relative; top:1px">[[File:{{#if:{{{icon|}}}|{{#switch:{{{icon}}}
<!-- if specified, replaces the icon even if the file extension is specified in {{{2}}} -->
|#default=icon-folder open-filled.png
 
|exe|executable=Icon-Windows_Executable.png
| #default = icon-gnome-folder alt.png
|reg|regedit|registry|regvalue|regv=Icon-regedit-2D-PathTemplate.png
| custom = {{{customico}}}
|custom={{{customico}}}
| app|bat|com|exe|sh|executable = Icon-Windows_Executable.png
|audio|sound|music=Icon-Music-Note.png
| apk = Icon-Android.png
|video|movie=Icon-Video_File-filled.png
| code|c|h|c++|hpp|cpp= Cpp-16px.png
|image|picture=Icon-Image-filled.png
| java|jar= Icon_java.png
|texture=Icon-Image-filled.png<!-- Texture file will have same icon as image, but the tooltip will remain different.-->
| msi|flatpak|installer|setup = Icon-Windows_Installer.png
|generic|file=Icon-File-filled-cropped.png
| reg|regedit|registry|regvalue|regv = Icon-regedit-2D-PathTemplate.png
}}|{{#switch:{{{2}}}
| audio|sound|music = Icon-Music-Note.png
|#default=icon-folder open-filled.png
| fmv|video|movie = Icon-Video_File-filled.png
|app|bat|com|exe|sh=Icon-Windows_Executable.png
| image|picture = Icon-Image-filled.png
|wav|mp3|ogg|vsnd_c=Icon-Music-Note.png
| 7z|tar.gz|tgz|zip|zipx|rar|vpk|pak = Folder_zip_icon.png
|avi|bik|mkv|mov|mp4|wmv|webm=Icon-Video_File-filled.png
| vmf|hammer= Icon-Hammer_4.x.png
|apng|bmp|jpg|jpeg|png|spr|tga|tiff|vtf|vtex_c|webp=Icon-Image-filled.png
| texture = Icon-Image-filled.png<!-- Texture file currently same icon as image, but the tooltip will remain different -->
}}}}|baseline|alt={{#switch:{{{icon}}}
<!-- |pak|package=Icon-Package.png -->
|#default={{Path/strings|Folder}}
<!-- |zip|archive=Icon-Archive.png -->
|exe=Windows Executable
<!-- |mdl|model=Icon-Model.png -->
|reg|regedit|registry=Registry Path
<!-- |map=Icon-Map.png -->
|regvalue|regv=Registry Value
| generic|file = Icon-File-filled-cropped.png
|custom=Custom Icon
}}
|audio|sound|music={{Unicode|}}
      | {{#switch: {{lc:{{{2}}}}}
|video|movie={{Unicode|[►]}}
 
|image|picture={{Path/strings|ImageIconFallback}}
<!-- if the file extension is specified in {{{2}}} and {{{icon}}} was not specified, this will be used -->
|texture={{Path/strings|TexturesIconFallback}}
 
|generic|file={{Path/strings|File}} <!-- alt parameter will be used for unicode fallback if the icon doesnt load properly.  
| #default = icon-gnome-folder alt.png
Emojis are not recommended as older OS usually may lacking certain emojis.-->
| app|bat|com|exe|sh = Icon-Windows_Executable.png
}}|15px]]</span><!--
| apk = Icon-Android.png
| java|jar = Icon_java.png
| code|c|h|c++|hpp|cpp = Cpp-16px.png
| msi|flatpak|deb = Icon-Windows_Installer.png
| wav|mp3|ogg|opus|flac|wma|xwv|vsnd_c|sound.cache = Icon-Music-Note.png
| avi|bik|mkv|mov|mp4|wmv|webm|ogv = Icon-Video_File-filled.png
| txt|rtf|wpd = Icon-edit-filled.png
| fxc = Icon-shader.png
| py|pyc = Python-16px.png
| nut|nuc = Sq-highres.png
| lua = Lua-16px.png
| chm = Icon-help.png
| config|cfg=Icon-settings_applications.png
| apng|bmp|jpg|jpeg|pcx|png|tga|tif|tiff|webp|svg|vsvg|vsvg_c = Icon-Image-filled.png
| dds|spr|vtf|vtex_c|wal = Icon-Image-filled.png<!--currently same icon as image-->
| 7z|tar.gz|tgz|zip|zipx|rar|vpk|pak|wad|tar|bz2|pk3 = Folder_zip_icon.png
| vmap = Icon-Hammer_5.x.png
| vmf|vmx|hammer = Icon-Hammer_4.x.png
| rmf|rmx|map = Icon-Hammer_3.x.png
| jmf|jmx = jack_icon.png
<!-- |TAR|tar|PAK|pak|WAD|wad|VPK|vpk = Icon-Package.png -->
<!-- |MDL|mdl|MD2|md2|MD3|md3|VMDL|vmdl|VMDL_C|vmdl_c|PHY|phy|VTX|vtx|VVD|vvd = Icon-Model.png -->
<!-- |BSP|bsp|VMAP_C|vmap_c|VMF|vmf = Icon-Map.png -->
}}
      }}|baseline|alt={{#switch: {{lc:{{{icon}}}}}
 
<!-- fallback if icons are not loaded properly -->
 
| #default = 🖿
| custom = Custom Icon
| app|bat|com|exe = Windows Executable
| apk = Android APK
| code= Code
| c++|cpp= C++ code
| h = C++ Header File
| java|jar = Java Executable
| msi = Windows Installer
| flatpak = Flatpak Installer
| installer|setup = Installer
| reg|regedit|registry = Registry Path
| regvalue|regv = Registry Value
| audio|sound|music = 🎜
| fmv|video|movie = 🎬︎
| txt|rtf|wpd = Text File
| fxc = Shader File
| image|picture = 🖼{{Path/strings|ImageIconFallback}}
| 7z|tar.gz|tgz|zip|zipx|rar|vpk|pak = 🗂️ (Compressed)
| vmf|hammer = VMF <small>(Valve Map Format)</small>
| texture|tex = {{Path/strings|TexturesIconFallback}}
<!-- |PAK|pak|PACKAGE|package={{Path/strings|PackageIconFallback}} -->
<!-- |ZIP|zip|ARCHIVE|archive={{Path/strings|ArchiveIconFallback}} -->
<!-- |MDL|mdl|MODEL|model={{Path/strings|ModelIconFallback}} -->
<!-- |MAP|map={{Path/strings|MapIconFallback}} -->
| generic|file = {{Path/strings|File}}<!-- alt parameter will be used for Unicode fallback if the icon doesn't load properly.  
Emojis are not recommended as older OSes may lack certain emojis.-->
}}|15px|link=]]<!--
--></span><!--
--></span><!--
--></span><!--
--><code style="background-color:rgba({{#if:{{{2|}}}|152,78,221,.25|83,111,255,.25}}); border-radius:0 4px 4px 0; color:#CCC; padding:0 4px; {{#if:{{{select|}}}|user-select:{{{select}}}|}}">{{{1|}}}{{#if:{{{2|}}}|.{{#ifexist: {{{2}}} | [[{{{2}}}]] | {{{2}}} }}|}}</code><!--
 
--></span></onlyinclude></includeonly>
--><code>{{{1|}}}{{#if:{{{2|}}}|.{{#switch: {{lc:{{{2}}}}}
| exe = [[w:.exe|<span style="color:grey">exe</span>]]
| txt = txt
| #default = [[{{lc:{{{2}}}}}|{{{2}}}]]}}
}}</code><!--
 
--></span></onlyinclude>
 
</includeonly>

Latest revision as of 06:16, 9 May 2025

Todo: Fall back to generic file icon instead of folder icon if {{{2}}} is present.
Todo: Icons for models, maps, compressed archives, and uncompressed packages. Syntax exists, and just needs to be uncommented when the icons are ready.
Todo: Icons for linked libraries (DLL, SO, DYLIB).
Todo: Separate designation for compressed vs uncompressed archives.
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history
Icon-translate.png
This template uses a strings subpage
Please follow the format on this subpage(s) to add translations.

The path to the folder or file. {{file}} aliases here.

Parameters and Examples

Parameter Description Examples Preview
{{{1}}} The path to the folder or file.
{{Path|C:\Program Files\Steam}}
🖿C:\Program Files\Steam
{{{2}}} File extension, if any. Omit the dot.
{{Path|D:\Program Files\Steam\steam|exe}}
{{Path|de_dust2|bsp}}
{{Path|materials\debug\debugempty|vtf}}
🖿D:\Program Files\Steam\steam.exe
🖿de_dust2.bsp
🖿materials\debug\debugempty.vtf
{{{select}}} Text selection mode based on the CSS property user-select.
No effect on some browsers.
Warning.pngWarning:select=none is likely to cause user frustration; use sparingly.
{{Path|select=none|C:\Program Files}}
{{Path|select=all|C:\Program Files}}
🖿C:\Program Files
🖿C:\Program Files
{{{icon}}}
{{{customico}}}
Changes the icon. The tooltip (which appears if you are hovering the text or the icon itself), will have it's text changed aswell.

If the images is disabled in your browser or when a new icon file is being uploaded, it may fallback to Unicode symbols or simple text.

{{{customico}}} is used to change to any icon if you want. Tooltip will likely be limited with this method, which only refers custom icon as a generic file, and may cause a scaling bug (more noticeable when zooming in).
Executable:
{{Path|hl2|exe|icon=exe}}
Registry path:
{{Path|Computer\HKEY_CURRENT_USER\SOFTWARE\Valve\Source|icon=reg}}
Registry value:
{{Path|DXLevel_V1|icon=regv}}
Audio/Music:
{{Path|Half-Life01|mp3|icon=audio}}
Videos:
{{Path|valve|bik|icon=video}}
File (generic):
{{Path|example|sound.cache|icon=file}}
Image:
{{Path|d1_trainstation_010000|jpg|icon=image}}
Texture (currently same icon, but this will likely change):
{{Path|alyx_sheet|vtf|icon=texture}}
Custom icon:
{{Path|hl2|exe|icon=custom|customico=HL2-hires.png}}
Windows Executablehl2.exe
Registry PathHKEY_CURRENT_USER\SOFTWARE\Valve\Source
Registry ValueDXLevel_V1
🎜Half-Life01.mp3
🎬︎valve.bik
Fileexample.sound.cache
🖼Imaged1_trainstation_010000.jpg
Texturealyx_sheet.vtf
Custom Iconp3.exe

See also