Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a user-friendly message how to create config #34

Closed
wants to merge 2 commits into from

Conversation

astanin
Copy link
Contributor

@astanin astanin commented Feb 10, 2016

Two changes to improve first user experience:

  • print instructions how to create config and register the app if the config is missing
  • create sync_dir automatically if it doesn't exist

Currently the program just dumps a backtrace in both cases.

Backtrace on the first run of the program could be confusing to many users. Personally I ran it through strace to find out where I should put the config. While the information is already in the README, I believe that a giving more specific suggestions to the user can improve user experience.

Before this patch:

$ ./onedrive 
object.Exception@src/config.d(16): No config file found
----------------
??:? ref config.Config config.Config.__ctor(immutable(char)[][]...) [0x5b8666]
??:? _Dmain [0x5bd11a]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x5d8a42]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5d8980]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x5d89fe]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5d8980]
??:? _d_run_main [0x5d88dd]
??:? main [0x5bf915]
??:? __libc_start_main [0x67d7dec4]

After this patch:

$ ./onedrive 
Configuration file is not found.

If this is the first time you run onedrive, you should create a configuration
file in /home/sergey/.config/onedrive/config or /usr/local/etc/onedrive.conf or /etc/onedrive.conf. Run:

mkdir -p ~/.config/onedrive
cat > ~/.config/onedrive/config << EOF
client_id = ""
client_secret = ""
sync_dir = "~/OneDrive"
skip_file = ".*|~*"
skip_dir = ".*"
EOF

Then edit ~/.config/onedrive/config.
To get client_id and client_secret, please register this application at
https://dev.onedrive.com/app-registration.htm
and copy both keys from App Settings.

object.Exception@src/config.d(38): No config file found
----------------
??:? ref config.Config config.Config.__ctor(immutable(char)[][]...) [0x5b9285]
??:? _Dmain [0x5bdd4a]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x5d9736]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5d9674]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x5d96f2]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x5d9674]
??:? _d_run_main [0x5d95d1]
??:? main [0x5c0545]
??:? __libc_start_main [0x3d546ec4]

@Scimmia22
Copy link
Contributor

This is pretty much moot now, isn't it?

@skilion
Copy link
Owner

skilion commented Jun 16, 2017

Now the config file is optional

@skilion skilion closed this Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants