mathew-kurian / Scribe.js

:scroll: Node.js logging made simple! Online access to logs and more...
https://mathew-kurian.github.io/Scribe.js/
MIT License
284 stars 45 forks source link

Wrong slicing of home directory #6

Closed wizche closed 10 years ago

wizche commented 10 years ago

Hi,

Under linux the control panel does not display the data, the problem is that in linux activeUserDir will be /home/username, but in the control panel you loop under 'username/' folder only. To fix this I changed

activeUserDir = activeUserDir.slice(activeUserDir.lastIndexOf('\\') + 1);

into

activeUserDir = activeUserDir.slice(activeUserDir.lastIndexOf((process.platform == 'win32') ? '\\':'/') + 1);

Otherwise you could use the path.sep property (http://nodejs.org/api/path.html#path_path_sep)

Furthermore I've initialized the 'mainUser' variable using the process.env.USER: mainUser : process.env.USER, in the index.js so you don't have to set it manually in the scribe options.

Awesome project, keep going!

nover commented 10 years ago

Nice fix :) I can confirm that this also gets the "log listing" on OS X to actually work.

I took the liberty of creating a pull request, I hope you don't mind. https://github.com/bluejamesbond/Scribe.js/pull/7

wizche commented 10 years ago

Cool, good job, no problem at all :)

mathew-kurian commented 10 years ago

Thanks guys!