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

Make temporary folder (for logs) cross-platform #2501

Closed
softvision-oana-arbuzov opened this issue Jun 18, 2018 · 7 comments
Closed

Make temporary folder (for logs) cross-platform #2501

softvision-oana-arbuzov opened this issue Jun 18, 2018 · 7 comments

Comments

@softvision-oana-arbuzov
Copy link
Member

Environment:
Operating System: Windows 10 Pro

Steps to Reproduce:

  1. Follow Development Environment setup guide for Windows.
  2. Check logs.

Expected Behavior:
Logs point out to "temp" folder for Windows and "tmp" for Linux/Mac.

Actual Behavior:
Logs point out to "tmp" folder.

Note:

  1. "tmp" from Linux/Mac folder in __init__.py file from Config folder (C:\\tmp\\webcompat.log) is "temp" folder on Windows;
  2. If repository is installed on a different location (e.g D partition) a "Temp" folder needs to be manually created.
    image
  3. Update all other documents to reflect the change.
@miketaylr
Copy link
Member

Thanks for filing @softvision-oana-arbuzov!

I'll take a stab at this.

@miketaylr miketaylr self-assigned this Jun 18, 2018
@miketaylr miketaylr changed the title Update files to point out to "temp" folder for Windows users Make temporary folder (for logs) cross-platform Jun 18, 2018
@miketaylr
Copy link
Member

Changing the title a bit...

@softvision-oana-arbuzov
Copy link
Member Author

@miketaylr and @karlcow some little updated for tmp folder to be set according to the platform used.

In __init__.py file:

def getTempPath():
    return "temp" if sys.platform is "win32" else "tmp"

LOG_FILE = os.path.join(getTempPath(), '/webcompat.log')
LOG_FMT = '%(asctime)s tracking %(message)s'
CSP_REPORTS_LOG = os.path.join(getTempPath(), '/webcompat-csp-reports.log')

Please review.

@miketaylr
Copy link
Member

The code looks good, but I'm not sure it's needed. The current approach is to create a tmp directory in the webcompat.com source dir (so, webcompat.com/tmp/), so it doesn't really matter what platform you're on. It might be a little confusing that I used tmp, which looks unix-y.

Does that make sense? Or is it failing for you as-is on the latest master?

@miketaylr
Copy link
Member

(or, it could be webcompat.com\tmp, on windows, but os.path.join(os.getcwd(), 'tmp') should take care of that. this is one of the reasons i think we should only support windows w/ linux subsystem shell -- it simplifies things a lot)

@karlcow
Copy link
Member

karlcow commented Jun 29, 2018

yes in this case, I don't think it matters. This is just a location to save the file. Plus having two different names for tmp will further complicate the documentation or any scripts that would handle log rotations and stuff.

@softvision-oana-arbuzov
Copy link
Member Author

@miketaylr and @karlcow that sounds good too, I will update my files and check again if it works on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants