{"action":"created","issue":{"url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/11","labels_url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/11/comments","events_url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/11/events","html_url":"https://github.com/slapresta/rust-dotenv/pull/11","id":119478197,"number":11,"title":"Fix directory when using Cargo","user":{"login":"alicemaz","id":11409285,"avatar_url":"https://avatars.githubusercontent.com/u/11409285?v=3","gravatar_id":"","url":"https://api.github.com/users/alicemaz","html_url":"https://github.com/alicemaz","followers_url":"https://api.github.com/users/alicemaz/followers","following_url":"https://api.github.com/users/alicemaz/following{/other_user}","gists_url":"https://api.github.com/users/alicemaz/gists{/gist_id}","starred_url":"https://api.github.com/users/alicemaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alicemaz/subscriptions","organizations_url":"https://api.github.com/users/alicemaz/orgs","repos_url":"https://api.github.com/users/alicemaz/repos","events_url":"https://api.github.com/users/alicemaz/events{/privacy}","received_events_url":"https://api.github.com/users/alicemaz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-30T12:00:03Z","updated_at":"2015-11-30T12:03:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/slapresta/rust-dotenv/pulls/11","html_url":"https://github.com/slapresta/rust-dotenv/pull/11","diff_url":"https://github.com/slapresta/rust-dotenv/pull/11.diff","patch_url":"https://github.com/slapresta/rust-dotenv/pull/11.patch"},"body":"When a project is run via Cargo, `current_dir()` returns the\r\ndirectory `cargo run` was called from, essentially an arbitrary\r\nlocation. This is confirmed working as intended.\r\n\r\nPreviously, `dotenv()` would check `current_dir()` and error if\r\nit could not find an `.env` file there. This change makes it so\r\nthat it will also check the directory Cargo loaded `Cargo.toml`\r\nfrom before returning an error.\r\n\r\nProjects that do not use Cargo are not affected by this change."},"comment":{"url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/comments/160610733","html_url":"https://github.com/slapresta/rust-dotenv/pull/11#issuecomment-160610733","issue_url":"https://api.github.com/repos/slapresta/rust-dotenv/issues/11","id":160610733,"user":{"login":"alicemaz","id":11409285,"avatar_url":"https://avatars.githubusercontent.com/u/11409285?v=3","gravatar_id":"","url":"https://api.github.com/users/alicemaz","html_url":"https://github.com/alicemaz","followers_url":"https://api.github.com/users/alicemaz/followers","following_url":"https://api.github.com/users/alicemaz/following{/other_user}","gists_url":"https://api.github.com/users/alicemaz/gists{/gist_id}","starred_url":"https://api.github.com/users/alicemaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alicemaz/subscriptions","organizations_url":"https://api.github.com/users/alicemaz/orgs","repos_url":"https://api.github.com/users/alicemaz/repos","events_url":"https://api.github.com/users/alicemaz/events{/privacy}","received_events_url":"https://api.github.com/users/alicemaz/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T12:03:04Z","updated_at":"2015-11-30T12:03:04Z","body":"hi all! super happy to find a dotenv for rust. I use the node equivalent a lot so this project is very relevant to my interests.\r\n\r\nran into this issue working from a subdir, seemed like a sensible fix. I admit the nested matching is a bit ugly. I tried putting together something a bit cleaner with `.and_then()` `or_else()` etc but ran into the clashing error types mentioned in the readme and figured it was better to submit than tinker with other parts at the same time. if there's a way you'd prefer it organized, I'd be glad to update. only been writing rust a few days so there may be a simpler syntax I'm missing.\r\n\r\nI get the impression `from_filename()` is supposed to automagically Just Work like `dotenv()` does, so I was thinking of changing that around a bit as well. flagged up a minor issue in #10 but really what I'd like to do is move all the logic in there and make `dotenv()` do nothing but call it with arg \".env\". also happy to help with the errors thing, and whatever else.\r\n\r\nanyway! yay dotenv A+ workflow"}}