Index: /FCKpackager/trunk/_samples/basic/basic_sample_compressed.js
===================================================================
--- /FCKpackager/trunk/_samples/basic/basic_sample_compressed.js	(revision 334)
+++ /FCKpackager/trunk/_samples/basic/basic_sample_compressed.js	(revision 335)
Index: /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_gecko.js
===================================================================
--- /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_gecko.js	(revision 334)
+++ /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_gecko.js	(revision 335)
Index: /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_ie.js
===================================================================
--- /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_ie.js	(revision 334)
+++ /FCKpackager/trunk/_samples/fckeditor/fckeditorcode_ie.js	(revision 335)
Index: /FCKpackager/trunk/_source/includes/common.inc
===================================================================
--- /FCKpackager/trunk/_source/includes/common.inc	(revision 334)
+++ /FCKpackager/trunk/_source/includes/common.inc	(revision 335)
@@ -1,3 +1,3 @@
-<?php
+﻿<?php
 /*
  * FCKpackager - JavaScript Packager and Compressor - http://www.fckeditor.net
@@ -29,5 +29,5 @@
 function StrEndsWith( $str, $sub )
 {
-   return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ;
+	return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ) ;
 }
 
@@ -42,19 +42,14 @@
 function CreateDir($path, $rights = 0777)
 {
-	$folder_path = array(
-		strstr( $path, '.' ) ? dirname( $path ) : $path ) ;
+	$dirParts = explode( '/', $path ) ;
 
-	while ( !@is_dir( dirname( end( $folder_path ) ) )
-			&& dirname( end( $folder_path ) ) != '/'
-			&& dirname( end( $folder_path ) ) != '.'
-			&& dirname( end( $folder_path ) ) != '' )
+	$currentDir = '' ;
+
+	foreach ( $dirParts as $dirPart )
 	{
-		$folder_path[] = dirname( end( $folder_path ) ) ;
-	}
+		$currentDir .= $dirPart . '/' ;
 
-	while ( $parent_folder_path = array_pop( $folder_path ) )
-	{
-		if ( !@mkdir( $parent_folder_path, $rights ) )
-			ExitError( "Can't create folder \"$parent_folder_path\"." ) ;
+		if ( strlen( $dirPart ) > 0 && !is_dir( $currentDir ) )
+			mkdir( $currentDir, $rights ) ;
 	}
 }
@@ -70,22 +65,5 @@
 		fwrite( $f, "\xEF\xBB\xBF" ) ;	// BOM
 
-	fwrite( $f, $strData ) ;
-	fclose( $f ) ;
-
-	return TRUE ;
-}
-
-function SaveStringToUtf8File( $strData, $filePath, $includeBom = TRUE )
-{
-	$f = @fopen( $filePath, 'wb' ) ;
-
-	if ( !$f )
-		return FALSE ;
-
-	if ( $includeBom )
-		fwrite( $f, "\xEF\xBB\xBF" ) ;	// BOM
-
-	fwrite( $f, ( $strData ) ) ;
-
+	fwrite( $f, StripUtf8Bom( $strData ) ) ;
 	fclose( $f ) ;
 
Index: /FCKpackager/trunk/_source/includes/fckpackagefile.inc
===================================================================
--- /FCKpackager/trunk/_source/includes/fckpackagefile.inc	(revision 334)
+++ /FCKpackager/trunk/_source/includes/fckpackagefile.inc	(revision 335)
@@ -88,5 +88,5 @@
 
 			// Each file terminates with a CRLF, even if compressed.
-			$outputData .= "\n" ;
+			$outputData .= "\r\n" ;
 		}
 
Index: /FCKpackager/trunk/_source/includes/fckpreprocessor.inc
===================================================================
--- /FCKpackager/trunk/_source/includes/fckpreprocessor.inc	(revision 334)
+++ /FCKpackager/trunk/_source/includes/fckpreprocessor.inc	(revision 335)
@@ -29,8 +29,8 @@
 	function ProcessFile( $sourceFilePath, $destinationFilePath, $onlyHeader = FALSE )
 	{
-		SaveStringToUtf8File(
+		SaveStringToFile(
 			FCKPreProcessor::Process( file_get_contents( $sourceFilePath ), $onlyHeader ),
 			$destinationFilePath,
-			( !StrEndsWith( $sourceFilePath, '.asp' ) && !StrEndsWith( $sourceFilePath, '.js' ) ) ) ;	// Only ASP and JavaScript files require the BOM.
+			( StrEndsWith( $sourceFilePath, '.asp' ) || StrEndsWith( $sourceFilePath, '.js' ) ) ) ;	// Only ASP and JavaScript files require the BOM.
 
 		// Set the destination file Last Access and Last Write times.
Index: /FCKpackager/trunk/fckpackager.php
===================================================================
--- /FCKpackager/trunk/fckpackager.php	(revision 334)
+++ /FCKpackager/trunk/fckpackager.php	(revision 335)
@@ -34,5 +34,5 @@
 // Check the number of arguments passed. The first one is the script name.
 if ( count( $argv ) > 2 )
-	ExitError( 'Invalid arguments. Operation aborted' ) ;
+	ExitError( 'Invalid arguments. Operation aborted.' ) ;
 
 // Get the package definition file
@@ -45,4 +45,5 @@
 $packager->LoadDefinitionFile( $xmlFileName ) ;
 $packager->Run() ;
+
 ?>
 
@@ -499,5 +500,5 @@
 
 			// Each file terminates with a CRLF, even if compressed.
-			$outputData .= "\n" ;
+			$outputData .= "\r\n" ;
 		}
 
Index: /FCKpackager/trunk/web/javascriptcompressor.php
===================================================================
--- /FCKpackager/trunk/web/javascriptcompressor.php	(revision 334)
+++ /FCKpackager/trunk/web/javascriptcompressor.php	(revision 335)
@@ -2,6 +2,6 @@
 <?php
 
-require_once( '../includes/fckcontantprocessor.inc' ) ;
-require_once( '../includes/fckjavascriptcompressor.inc' ) ;
+require_once( '../_source/includes/fckcontantprocessor.inc' ) ;
+require_once( '../_source/includes/fckjavascriptcompressor.inc' ) ;
 
 if ( isset( $_POST['xInputScript'] ) )
