{"action":"created","issue":{"url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/473","repository_url":"https://api.github.com/repos/RetroPie/EmulationStation","labels_url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/473/comments","events_url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/473/events","html_url":"https://github.com/RetroPie/EmulationStation/issues/473","id":352043262,"node_id":"MDU6SXNzdWUzNTIwNDMyNjI=","number":473,"title":"FileUtils: Error generating image path when $HOME ends with slash","user":{"login":"cmitu","id":31816814,"node_id":"MDQ6VXNlcjMxODE2ODE0","avatar_url":"https://avatars2.githubusercontent.com/u/31816814?v=4","gravatar_id":"","url":"https://api.github.com/users/cmitu","html_url":"https://github.com/cmitu","followers_url":"https://api.github.com/users/cmitu/followers","following_url":"https://api.github.com/users/cmitu/following{/other_user}","gists_url":"https://api.github.com/users/cmitu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmitu/subscriptions","organizations_url":"https://api.github.com/users/cmitu/orgs","repos_url":"https://api.github.com/users/cmitu/repos","events_url":"https://api.github.com/users/cmitu/events{/privacy}","received_events_url":"https://api.github.com/users/cmitu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-20T08:58:56Z","updated_at":"2018-08-20T11:43:40Z","closed_at":null,"author_association":"NONE","body":"First reported in https://retropie.org.uk/forum/topic/18924/metadata-being-changed-on-exit.\r\n\r\n  When the $HOME/%HOME% variable ends with a trailing `/`, the `removeCommonPath` generates the wrong `image` path in the `gamelist.xml` file. The function is called, when metadata is saved, from `createRelativePath` with the input parameters:\r\n * `path` = C:/Portable/emulationstation//.emulationstation/downloaded_images/pcengine/Legendary Axe, The (USA)-image.jpg\r\n* `common`  = C:/Portable/emulationstation/ (which is `%HOME%`)\r\n\r\n Subsequently, `removeCommonPath` returns the relative path for the `image` tag as **emulationstation/downloaded_images/pcengine/Legendary Axe, The (USA)-image.jpg**, to which `createRelativePath` is pre-pending **~**, resulting in a wrong image. \r\nThe correct relative path should be **.emulationstation/downloaded_images/pcengine/Legendary Axe, The (USA)-image.jpg**, to which `createRelativePath` would prepend **~/** to generate the correct image path.\r\n\r\n A possible fix is to replace the `getGenericPath` inside `removeCommonPath` with `getGenericPath`, this will normalize the `common` parameter and remove the final `/` from the directory name."},"comment":{"url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/comments/414287593","html_url":"https://github.com/RetroPie/EmulationStation/issues/473#issuecomment-414287593","issue_url":"https://api.github.com/repos/RetroPie/EmulationStation/issues/473","id":414287593,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDI4NzU5Mw==","user":{"login":"tomaz82","id":3128975,"node_id":"MDQ6VXNlcjMxMjg5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/3128975?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaz82","html_url":"https://github.com/tomaz82","followers_url":"https://api.github.com/users/tomaz82/followers","following_url":"https://api.github.com/users/tomaz82/following{/other_user}","gists_url":"https://api.github.com/users/tomaz82/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaz82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaz82/subscriptions","organizations_url":"https://api.github.com/users/tomaz82/orgs","repos_url":"https://api.github.com/users/tomaz82/repos","events_url":"https://api.github.com/users/tomaz82/events{/privacy}","received_events_url":"https://api.github.com/users/tomaz82/received_events","type":"User","site_admin":false},"created_at":"2018-08-20T11:43:40Z","updated_at":"2018-08-20T11:43:40Z","author_association":"COLLABORATOR","body":"Ran several tests and I can't reproduce this bug.\r\ngetGenericPath does remove the double / so it returns the path `.emulationstation/downloaded_images/pcengine/Legendary Axe, The (USA)-image.jpg`\r\n\r\n"}}
{"actor":{"display_login":"tomaz82"}}