From 29fdb6216d9acb270ee9bd2811e7026b3e7c7cbf Mon Sep 17 00:00:00 2001 From: vguna Date: Sun, 7 Aug 2016 17:29:55 +0200 Subject: [PATCH 1/2] more ignores --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a51a3c3..b9abbeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.buildpath +.project +.settings .idea/ config.core.php data/ From f429c9638968b2768b221ac5c0c7b7a34281cf78 Mon Sep 17 00:00:00 2001 From: vguna Date: Sun, 7 Aug 2016 22:57:57 +0200 Subject: [PATCH 2/2] fixed windows filename handling --- src/BaseCommand.php | 4 ++++ src/Command/BuildCommand.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/BaseCommand.php b/src/BaseCommand.php index d2312d0..4b6392a 100644 --- a/src/BaseCommand.php +++ b/src/BaseCommand.php @@ -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; } diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php index 8543260..c73462c 100644 --- a/src/Command/BuildCommand.php +++ b/src/Command/BuildCommand.php @@ -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) {