Skip to content

fix: fix creation of directories with absolute path on Windows#289

Merged
Swatinem merged 1 commit intogetsentry:masterfrom
Mixaill:windows-absolutpath
Jun 10, 2020
Merged

fix: fix creation of directories with absolute path on Windows#289
Swatinem merged 1 commit intogetsentry:masterfrom
Mixaill:windows-absolutpath

Conversation

@Mixaill
Copy link
Copy Markdown
Contributor

@Mixaill Mixaill commented Jun 10, 2020

Fix creation of directories which have drive letter in path.

supersedes #276
fixes #281


for (ptr = p; *ptr; ptr++) {
if ((*ptr == L'\\' || *ptr == L'/') && ptr != p) {
if ((*ptr == L'\\' || *ptr == L'/') && ptr != p && ptr[-1] != L':') {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to note, ptr[-1] is safe here, because ptr != p prevents execution when ptr points the start of the string

Copy link
Copy Markdown
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, this really looks cleaner than the other PR

@Swatinem Swatinem merged commit 19ad6e7 into getsentry:master Jun 10, 2020
@Mixaill Mixaill deleted the windows-absolutpath branch June 11, 2020 10:23
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.

sentry_init fails if database path on different drive

2 participants