{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/6966","repository_url":"https://api.github.com/repos/PowerShell/PowerShell","labels_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/6966/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/6966/comments","events_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/6966/events","html_url":"https://github.com/PowerShell/PowerShell/issues/6966","id":328166523,"node_id":"MDU6SXNzdWUzMjgxNjY1MjM=","number":6966,"title":"Add a -SpecialFolder parameter to Set-Location / Get-Location to allow changing to / determining the locations of special (known) folders","user":{"login":"mklement0","id":588825,"node_id":"MDQ6VXNlcjU4ODgyNQ==","avatar_url":"https://avatars2.githubusercontent.com/u/588825?v=4","gravatar_id":"","url":"https://api.github.com/users/mklement0","html_url":"https://github.com/mklement0","followers_url":"https://api.github.com/users/mklement0/followers","following_url":"https://api.github.com/users/mklement0/following{/other_user}","gists_url":"https://api.github.com/users/mklement0/gists{/gist_id}","starred_url":"https://api.github.com/users/mklement0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklement0/subscriptions","organizations_url":"https://api.github.com/users/mklement0/orgs","repos_url":"https://api.github.com/users/mklement0/repos","events_url":"https://api.github.com/users/mklement0/events{/privacy}","received_events_url":"https://api.github.com/users/mklement0/received_events","type":"User","site_admin":false},"labels":[{"id":552752388,"node_id":"MDU6TGFiZWw1NTI3NTIzODg=","url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Area-Cmdlets-Management","name":"Area-Cmdlets-Management","color":"5319e7","default":false},{"id":423526741,"node_id":"MDU6TGFiZWw0MjM1MjY3NDE=","url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Issue-Discussion","name":"Issue-Discussion","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-31T14:39:00Z","updated_at":"2018-05-31T17:02:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The filesystem has a number of special folders (a.k.a. known folders): usually preexisting folders that have special meaning to the OS.\r\n\r\nIt would be convenient to be able to target them in the abstract - both for convenience and for platform abstraction - similar to what .NET provides; e.g.:\r\n\r\n```powershell\r\n# E.g., on Windows:\r\nPS> [Environment]::GetFolderPath('Desktop')\r\nC:\\Users\\jdoe\\Desktop\r\n```\r\n\r\n`'Desktop'` translates to an enum value from the [`[Environment+SpecialFolder]`](https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder) enumeration.\r\n\r\nSupporting these enum values via a new `-SpecialFolder` (alias `-sf`) parameter natively in PowerShell would be handy\r\n\r\n```powershell\r\nSet-Location -SpecialFolder Desktop  # wishful thinking: changes to, e.g., C:\\Users\\jdoe\\Desktop\r\nGet-Location -SpecialFolder Desktop  # wishful thinking: returns, e.g., C:\\Users\\jdoe\\Desktop\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\nWritten as of:\r\n\r\n```powershell\r\nPowerShell Core v6.1.0-preview.2\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/comments/393602414","html_url":"https://github.com/PowerShell/PowerShell/issues/6966#issuecomment-393602414","issue_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/6966","id":393602414,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzYwMjQxNA==","user":{"login":"mklement0","id":588825,"node_id":"MDQ6VXNlcjU4ODgyNQ==","avatar_url":"https://avatars2.githubusercontent.com/u/588825?v=4","gravatar_id":"","url":"https://api.github.com/users/mklement0","html_url":"https://github.com/mklement0","followers_url":"https://api.github.com/users/mklement0/followers","following_url":"https://api.github.com/users/mklement0/following{/other_user}","gists_url":"https://api.github.com/users/mklement0/gists{/gist_id}","starred_url":"https://api.github.com/users/mklement0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mklement0/subscriptions","organizations_url":"https://api.github.com/users/mklement0/orgs","repos_url":"https://api.github.com/users/mklement0/repos","events_url":"https://api.github.com/users/mklement0/events{/privacy}","received_events_url":"https://api.github.com/users/mklement0/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T17:02:35Z","updated_at":"2018-05-31T17:02:35Z","author_association":"CONTRIBUTOR","body":"@rkeithhill:\r\n\r\nYes, but that (a) already works and (b) only if the current location is a filesystem location.\r\n\r\nWhile in a filesystem location, `~` is a convenient shortcut (that, unfortunately, is not fully semantically equivalent with (unquoted) `~` in POSIX-like shells such as `bash` due to its current-location sensitivity).\r\n\r\nThe stated limitation aside, you can therefore think of `~` as the _one_ special-folder shorthand in PowerShell that is already available, and for other special folders that _happen to be_ in the home folder's _subtree_, something like `~/Desktop` works well.\r\n\r\nHowever, just like `~` is a useful abstraction - it may refer to, say, `C:\\Users\\jdoe`, `/home/jdoe`, or `/Users/jdoe`, for instance - having abstractions for other well-known folders is equally useful, and that's where the special folders come in.\r\n\r\nFor instance, the `ApplicationData` special folder is something like `C:\\Users\\jdoe\\AppData\\Roaming` on Windows, and `$env:HOME/.config` on Unix-like platforms.\r\n\r\nEven `~` has its conceptual limitations: as @iSazonov  pointed out in https://github.com/PowerShell/PowerShell/issues/6791#issuecomment-393465147, you can think of `~` on _Unix_ corresponding to `~\\Documents` on _Windows_, given that Windows discourages creating user content directly in the profile folder;  \r\nUnlike, `~`, the `MyDocuments` (alias: `Personal`) special folder provides exactly this abstraction: it returns  the equivalent of `~` (`$HOME`) on Unix, and `~/Documents` on Windows.\r\n\r\nThe `~` shorthand doesn't scale well: something like `~~MyDocuments` and `~MyDocuments`, as stated, is a breaking change, but, perhaps more importantly, it would be self-contradictory in the case of _user-independent_ folders, such as `CommonApplicationData` (which is `C:\\ProgramData` on Windows, and `/usr/share` on Unix).\r\n"}}
{"actor":{"display_login":"mklement0"}}