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

Windows fixes #198

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.buildpath
.project
.settings
.idea/
config.core.php
data/
Expand Down
4 changes: 4 additions & 0 deletions src/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public function convertBytes($bytes)
public function normalizePath($path)
{
$normalized_path = str_replace('\\', Gitify::$directorySeparator, $path);
// especially for windows, convert utf8 to local encoding to fix umlauts in filenames
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$normalized_path = utf8_decode($normalized_path);
}

return $normalized_path;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ public function buildResources($context, $iterator)
$file = file_get_contents($resource->getRealPath());

// Normalize line-endings to \n to ensure consistency
/* this causes file modifications when comparing with afterwards extraction
$file = str_replace("\r\n", "\n", $file);
$file = str_replace("\r", "\n", $file);
*/

// Check if delimiter exists, otherwise add it to avoid WARN in explode()
// (WARN @ Gitify/src/Command/BuildCommand.php : 246) PHP notice: Undefined offset: 1
if (strpos($file, Gitify::$contentSeparator) === false) {
Expand Down