Merge remote branch 'origin/master' into zipped-oxp-support
Conflicts: Mac-specific Oolite.xcodeproj/project.pbxprojmaster
commit
721385aeb6
|
@ -47,7 +47,7 @@ Tichy
|
|||
Eric Walch
|
||||
Michael Werle (Micha)
|
||||
Gary Wong (Y A J)
|
||||
|
||||
Alexander Yancharuk
|
||||
|
||||
Library credits:
|
||||
----------------
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e6b72d6f1eeed7cd8e10db78cbb79ef85822a16a
|
||||
Subproject commit 304411f48221bb7dbea1a161bfec7f847258e9bf
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +0,0 @@
|
|||
(
|
||||
{
|
||||
path = ("assassins", 0, "do", 321, "do", 1, "conditions", 0);
|
||||
match = "shipsFound_number less than 20";
|
||||
replace = "shipsFound_number lessthan 20";
|
||||
},
|
||||
{
|
||||
path = ("assassins", 0, "do", 322, "do", 1, "conditions", 0);
|
||||
match = "shipsFound_number less than 20";
|
||||
replace = "shipsFound_number lessthan 20";
|
||||
}
|
||||
)
|
|
@ -2298,7 +2298,6 @@ this._hermitAllegiance = function(position,government)
|
|||
// default hermit status, allows all dockings but pirates will tend to
|
||||
// go elsewhere. We set this in shipdata but a shipset might not
|
||||
var allegiance = "neutral";
|
||||
log("hermit.calc",Math.floor(Math.abs(position.z)) % 4,Math.floor(Math.abs(position.y)) % 4,Math.floor(Math.abs(position.x)) % 4,government);
|
||||
if ((Math.floor(Math.abs(position.z)) % 4) * (Math.floor(Math.abs(position.y)) % 4) > government)
|
||||
{
|
||||
// pirates will use this hermit for docking and launching, but
|
||||
|
@ -2311,7 +2310,6 @@ this._hermitAllegiance = function(position,government)
|
|||
allegiance = "pirate";
|
||||
}
|
||||
}
|
||||
log("hermit.calc",allegiance);
|
||||
return allegiance;
|
||||
}
|
||||
|
||||
|
|
|
@ -1812,7 +1812,7 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
|||
NSDictionary *markedDestinations = [player markedDestinations];
|
||||
NSDictionary *systemData = nil;
|
||||
NSUInteger systemParameter;
|
||||
GLfloat r, g, b;
|
||||
GLfloat r = 1.0, g = 1.0, b = 1.0;
|
||||
BOOL noNova;
|
||||
|
||||
BOOL *systemsFound = [UNIVERSE systemsFound];
|
||||
|
|
|
@ -191,6 +191,11 @@ MA 02110-1301, USA.
|
|||
#define TEXT_KEY @"text"
|
||||
#define RGB_COLOR_KEY @"rgb_color"
|
||||
#define COLOR_KEY @"color"
|
||||
#define COLOR_KEY_LOW @"color_low"
|
||||
#define COLOR_KEY_MEDIUM @"color_medium"
|
||||
#define COLOR_KEY_HIGH @"color_high"
|
||||
#define COLOR_KEY_CRITICAL @"color_critical"
|
||||
#define COLOR_KEY_SURROUND @"color_surround"
|
||||
#define N_BARS_KEY @"n_bars"
|
||||
|
||||
#define ROWS_KEY @"rows"
|
||||
|
|
|
@ -60,6 +60,15 @@ MA 02110-1301, USA.
|
|||
#define WIDGET_SELECTOR 2
|
||||
|
||||
|
||||
/* Convenience macros to make set-colour-or-default quicker. 'info' must be the NSDictionary and 'alpha' must be the overall alpha or these won't work */
|
||||
#define DO_SET_COLOR(t,d) SetGLColourFromInfo(info,t,d,alpha)
|
||||
#define SET_COLOR(d) DO_SET_COLOR(COLOR_KEY,d)
|
||||
#define SET_COLOR_LOW(d) DO_SET_COLOR(COLOR_KEY_LOW,d)
|
||||
#define SET_COLOR_MEDIUM(d) DO_SET_COLOR(COLOR_KEY_MEDIUM,d)
|
||||
#define SET_COLOR_HIGH(d) DO_SET_COLOR(COLOR_KEY_HIGH,d)
|
||||
#define SET_COLOR_CRITICAL(d) DO_SET_COLOR(COLOR_KEY_CRITICAL,d)
|
||||
#define SET_COLOR_SURROUND(d) DO_SET_COLOR(COLOR_KEY_SURROUND,d)
|
||||
|
||||
struct CachedInfo
|
||||
{
|
||||
float x, y, x0, y0;
|
||||
|
@ -76,6 +85,7 @@ OOINLINE float useDefined(float val, float validVal)
|
|||
|
||||
static void DrawSpecialOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat step, GLfloat* color4v);
|
||||
|
||||
static void SetGLColourFromInfo(NSDictionary *info, NSString *key, const GLfloat defaultColor[4], GLfloat alpha);
|
||||
static void GetRGBAArrayFromInfo(NSDictionary *info, GLfloat ioColor[4]);
|
||||
|
||||
static void hudDrawIndicatorAt(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat amount);
|
||||
|
@ -1738,7 +1748,7 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
draw_surround = [info oo_boolForKey:DRAW_SURROUND_KEY defaultValue:SPEED_BAR_DRAW_SURROUND];
|
||||
|
||||
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
if (draw_surround)
|
||||
{
|
||||
// draw speed surround
|
||||
|
@ -1746,9 +1756,17 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
}
|
||||
// draw speed bar
|
||||
if (ds > .80)
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
{
|
||||
SET_COLOR_HIGH(red_color);
|
||||
}
|
||||
else if (ds > .25)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
{
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_COLOR_LOW(green_color);
|
||||
}
|
||||
|
||||
hudDrawBarAt(x, y, z1, siz, ds);
|
||||
}
|
||||
|
@ -1774,11 +1792,11 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (draw_surround)
|
||||
{
|
||||
// draw ROLL surround
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
// draw ROLL bar
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR(yellow_color);
|
||||
hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialRoll]);
|
||||
}
|
||||
|
||||
|
@ -1803,11 +1821,11 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (draw_surround)
|
||||
{
|
||||
// draw PITCH surround
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
// draw PITCH bar
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR(yellow_color);
|
||||
hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialPitch]);
|
||||
}
|
||||
|
||||
|
@ -1833,11 +1851,11 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (draw_surround)
|
||||
{
|
||||
// draw YAW surround
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
// draw YAW bar
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR(yellow_color);
|
||||
hudDrawIndicatorAt(x, y, z1, siz, [PLAYER dialYaw]);
|
||||
}
|
||||
|
||||
|
@ -1890,7 +1908,7 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (drawSurround)
|
||||
{
|
||||
// draw energy surround
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_SURROUND(yellow_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
|
||||
|
@ -1913,7 +1931,14 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
}
|
||||
}
|
||||
|
||||
GLColorWithOverallAlpha((energyCritical ? red_color : yellow_color), alpha);
|
||||
if (energyCritical)
|
||||
{
|
||||
SET_COLOR_LOW(red_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
}
|
||||
bankY = y - (n_bars - 1) * midBank;
|
||||
for (i = 0; i < n_bars; i++)
|
||||
{
|
||||
|
@ -1953,15 +1978,22 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (draw_surround)
|
||||
{
|
||||
// draw forward_shield surround
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
// draw forward_shield bar
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
if (shield < .80)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
if (shield < .25)
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
{
|
||||
SET_COLOR_LOW(red_color);
|
||||
}
|
||||
else if (shield < .80)
|
||||
{
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_COLOR_HIGH(green_color);
|
||||
}
|
||||
hudDrawBarAt(x, y, z1, siz, shield);
|
||||
}
|
||||
|
||||
|
@ -1986,16 +2018,23 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
|
||||
if (draw_surround)
|
||||
{
|
||||
// draw aft_shield surround
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
// draw forward_shield surround
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
// draw aft_shield bar
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
if (shield < .80)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
// draw forward_shield bar
|
||||
if (shield < .25)
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
{
|
||||
SET_COLOR_LOW(red_color);
|
||||
}
|
||||
else if (shield < .80)
|
||||
{
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_COLOR_HIGH(green_color);
|
||||
}
|
||||
hudDrawBarAt(x, y, z1, siz, shield);
|
||||
}
|
||||
|
||||
|
@ -2020,7 +2059,7 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
|
||||
if (draw_surround)
|
||||
{
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
|
||||
|
@ -2028,13 +2067,20 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
hr = [PLAYER dialHyperRange];
|
||||
|
||||
// draw fuel bar
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
hudDrawBarAt(x, y, z1, siz, fu);
|
||||
|
||||
// draw range indicator
|
||||
if (hr > 0.0f && hr <= 1.0f)
|
||||
{
|
||||
GLColorWithOverallAlpha([PLAYER hasSufficientFuelForJump] ? green_color : red_color, alpha);
|
||||
if ([PLAYER hasSufficientFuelForJump])
|
||||
{
|
||||
SET_COLOR_HIGH(green_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_COLOR_LOW(red_color);
|
||||
}
|
||||
hudDrawMarkerAt(x, y, z1, siz, hr);
|
||||
}
|
||||
}
|
||||
|
@ -2060,7 +2106,7 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
|
||||
if (draw_surround)
|
||||
{
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
|
||||
|
@ -2070,16 +2116,16 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (temp > .80)
|
||||
{
|
||||
if (temp > .90 && flash)
|
||||
GLColorWithOverallAlpha(redplus_color, alpha);
|
||||
SET_COLOR_CRITICAL(redplus_color);
|
||||
else
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
SET_COLOR_HIGH(red_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (temp > .25)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
else
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_LOW(green_color);
|
||||
}
|
||||
|
||||
[PLAYER setAlertFlag:ALERT_FLAG_TEMP to:((temp > .90)&&([self checkPlayerInFlight]))];
|
||||
|
@ -2107,17 +2153,17 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
|
||||
if (draw_surround)
|
||||
{
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_SURROUND(green_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
|
||||
// draw weapon_temp bar (only need to call GLColor() once!)
|
||||
if (temp > .80)
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
SET_COLOR_HIGH(red_color);
|
||||
else if (temp > .25)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
else
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_LOW(green_color);
|
||||
hudDrawBarAt(x, y, z1, siz, temp);
|
||||
}
|
||||
|
||||
|
@ -2142,7 +2188,7 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
|
||||
if (draw_surround)
|
||||
{
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_SURROUND(yellow_color);
|
||||
hudDrawSurroundAt(x, y, z1, siz);
|
||||
}
|
||||
|
||||
|
@ -2153,16 +2199,16 @@ OOINLINE void SetCompassBlipColor(GLfloat relativeZ, GLfloat alpha)
|
|||
if (alt < .25)
|
||||
{
|
||||
if (alt < .10 && flash)
|
||||
GLColorWithOverallAlpha(redplus_color, alpha);
|
||||
SET_COLOR_CRITICAL(redplus_color);
|
||||
else
|
||||
GLColorWithOverallAlpha(red_color, alpha);
|
||||
SET_COLOR_HIGH(red_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alt < .75)
|
||||
GLColorWithOverallAlpha(yellow_color, alpha);
|
||||
SET_COLOR_MEDIUM(yellow_color);
|
||||
else
|
||||
GLColorWithOverallAlpha(green_color, alpha);
|
||||
SET_COLOR_LOW(green_color);
|
||||
}
|
||||
|
||||
hudDrawBarAt(x, y, z1, siz, alt);
|
||||
|
@ -3874,6 +3920,26 @@ static void DrawSpecialOval(GLfloat x, GLfloat y, GLfloat z, NSSize siz, GLfloat
|
|||
@end
|
||||
|
||||
|
||||
static void SetGLColourFromInfo(NSDictionary *info, NSString *key, const GLfloat defaultColor[4], GLfloat alpha)
|
||||
{
|
||||
id colorDesc = nil;
|
||||
OOColor *color = nil;
|
||||
colorDesc = [info objectForKey:key];
|
||||
if (colorDesc != nil)
|
||||
{
|
||||
color = [OOColor colorWithDescription:colorDesc];
|
||||
if (color != nil)
|
||||
{
|
||||
GLfloat ioColor[4];
|
||||
[color getRed:&ioColor[0] green:&ioColor[1] blue:&ioColor[2] alpha:&ioColor[3]];
|
||||
GLColorWithOverallAlpha(ioColor,alpha);
|
||||
return;
|
||||
}
|
||||
}
|
||||
GLColorWithOverallAlpha(defaultColor,alpha);
|
||||
}
|
||||
|
||||
|
||||
static void GetRGBAArrayFromInfo(NSDictionary *info, GLfloat ioColor[4])
|
||||
{
|
||||
id colorDesc = nil;
|
||||
|
|
|
@ -32,7 +32,6 @@ MA 02110-1301, USA.
|
|||
#import "OODeepCopy.h"
|
||||
|
||||
|
||||
#define OUTPUT_PLIST_PATHS 0 // If nonzero, error locators are formatted for script-patches.plist.
|
||||
#define INCLUDE_RAW_STRING !defined(NDEBUG) // If nonzero, raw condition strings are included; if zero, a placeholder is used.
|
||||
|
||||
|
||||
|
@ -540,12 +539,7 @@ static NSMutableString *StringFromStackInternal(SanStackElement *topOfStack)
|
|||
|
||||
NSString *string = topOfStack->key;
|
||||
if (string == nil) string = [NSString stringWithFormat:@"%lu", (unsigned long)topOfStack->index];
|
||||
#if OUTPUT_PLIST_PATHS
|
||||
else string = [NSString stringWithFormat:@"\"%@\"", string];
|
||||
if ([base length] > 0) [base appendString:@", "];
|
||||
#else
|
||||
if ([base length] > 0) [base appendString:@"."];
|
||||
#endif
|
||||
|
||||
[base appendString:string];
|
||||
|
||||
|
@ -555,9 +549,5 @@ static NSMutableString *StringFromStackInternal(SanStackElement *topOfStack)
|
|||
|
||||
static NSString *StringFromStack(SanStackElement *topOfStack)
|
||||
{
|
||||
#if OUTPUT_PLIST_PATHS
|
||||
return [NSString stringWithFormat:@"(%@)", StringFromStackInternal(topOfStack)];
|
||||
#else
|
||||
return StringFromStackInternal(topOfStack);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
#! /bin/sh
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "error: usage: copy_game_resources <source directory> <destination directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
SOURCE_DIR=$1
|
||||
DESTINATION_DIR=$2
|
||||
|
||||
if [ ! $COPY_HELPER ]; then
|
||||
COPY_HELPER="$(dirname $0)/copy-resources"
|
||||
fi
|
||||
|
||||
|
||||
function perform_copy_base {
|
||||
"$COPY_HELPER" "$SOURCE_DIR/$1" "$DESTINATION_DIR/$2" "$3"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
}
|
||||
|
||||
# Usage: perform_copy <directory name> <file suffix>
|
||||
# Copies modified files from src/<directory name> to dst/<directory name>
|
||||
function perform_copy {
|
||||
perform_copy_base "$1" "$1" "$2"
|
||||
}
|
||||
|
||||
# Usage: perform_copy_binary <directory name> <file suffix>
|
||||
# Copies modified files from src/Binary/<directory name> to dst/<directory name>
|
||||
function perform_copy_binary {
|
||||
perform_copy_base "Binary/$1" "$1" "$2"
|
||||
}
|
||||
|
||||
|
||||
perform_copy AIs .plist
|
||||
perform_copy AIs .js
|
||||
perform_copy Config .plist
|
||||
perform_copy Scripts .js
|
||||
perform_copy Shaders .vertex
|
||||
perform_copy Shaders .fragment
|
||||
|
||||
perform_copy_binary Images .png
|
||||
# N.b.: Images .bmp deliberately excluded, being Windows-specific
|
||||
perform_copy_binary Models .dat
|
||||
perform_copy_binary Music .ogg
|
||||
perform_copy_binary Sounds .ogg
|
||||
perform_copy_binary Textures .png
|
|
@ -0,0 +1,74 @@
|
|||
#! /bin/sh
|
||||
|
||||
function fail {
|
||||
# Print an error and bail. error: prefix is used for the benefit of build tools.
|
||||
echo "error: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function verbose {
|
||||
# echo "$1"
|
||||
:
|
||||
}
|
||||
|
||||
function debug {
|
||||
# Uncomment for debugging.
|
||||
# echo " DEBUG: $1"
|
||||
:
|
||||
}
|
||||
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
fail "usage: copy_resources <source directory> <destination directory> <file extension>"
|
||||
fi
|
||||
|
||||
pushd "$1" > /dev/null
|
||||
SOURCE_DIR=$(pwd)
|
||||
popd > /dev/null
|
||||
|
||||
mkdir -p "$2"
|
||||
pushd "$2" > /dev/null
|
||||
DESTINATION_DIR=$(pwd)
|
||||
popd > /dev/null
|
||||
|
||||
FILE_EXTENSION=$3
|
||||
|
||||
|
||||
cd "$SOURCE_DIR"
|
||||
FILES=`ls *$FILE_EXTENSION 2> /dev/null`
|
||||
|
||||
if [ "$FILES" = "" ]; then
|
||||
echo "warning: no files matching *$FILE_EXTENSION found in $SOURCE_DIR"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
for FILE in $FILES; do
|
||||
DESTINATION_FILE="$DESTINATION_DIR/$FILE"
|
||||
SOURCE_FILE="$SOURCE_DIR/$FILE"
|
||||
|
||||
# If the destination file exists, don't copy if it has the same timestamp
|
||||
COPY_THIS_FILE=1
|
||||
if [ -e "$DESTINATION_FILE" ]; then
|
||||
SOURCE_MOD_DATE=$(stat -f "%m" "$SOURCE_FILE")
|
||||
DESTINATION_MOD_DATE=$(stat -f "%m" "$DESTINATION_FILE")
|
||||
if [ $SOURCE_MOD_DATE -eq $DESTINATION_MOD_DATE ]; then
|
||||
verbose "$FILE is up to date"
|
||||
COPY_THIS_FILE=""
|
||||
else
|
||||
debug "$FILE is out of date (src: $SOURCE_MOD_DATE dst: $DESTINATION_MOD_DATE)"
|
||||
fi
|
||||
else
|
||||
debug "$DESTINATION_FILE does not exist"
|
||||
fi
|
||||
|
||||
if [ $COPY_THIS_FILE ]; then
|
||||
echo "Copying $FILE"
|
||||
cp -p "$SOURCE_FILE" "$DESTINATION_FILE"
|
||||
if [ $? -ne 0 ]; then
|
||||
fail "Failed to copy $FILE"
|
||||
fi
|
||||
else
|
||||
debug "Not copying $FILE"
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue