Skip to content

Commit 2325d2e

Browse files
author
Ali Lloyd
committed
various standalone deploy fixes
1 parent 80f96b6 commit 2325d2e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

engine/src/deploy.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
118118
MCValueAssign(stackfile, t_temp_string);
119119
MCValueRelease(t_temp_string);
120120

121-
if (!ctxt.CopyElementAsFilepathArray(p_array, MCNAME("auxillary_stackfiles"), false, t_temp_array))
121+
if (!ctxt.CopyOptElementAsFilepathArray(p_array, MCNAME("auxillary_stackfiles"), false, t_temp_array))
122122
return false;
123123
MCValueAssign(auxillary_stackfiles, t_temp_array);
124124
MCValueRelease(t_temp_array);
125125

126-
if (!ctxt.CopyElementAsArray(p_array, MCNAME("externals"), false, t_temp_array))
126+
if (!ctxt.CopyOptElementAsArray(p_array, MCNAME("externals"), false, t_temp_array))
127127
return false;
128128
MCValueAssign(externals, t_temp_array);
129129
MCValueRelease(t_temp_array);
@@ -133,7 +133,7 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
133133
MCValueAssign(startup_script, t_temp_string);
134134
MCValueRelease(t_temp_string);
135135

136-
if (!ctxt.CopyElementAsArray(p_array, MCNAME("redirects"), false, t_temp_array))
136+
if (!ctxt.CopyOptElementAsArray(p_array, MCNAME("redirects"), false, t_temp_array))
137137
return false;
138138
MCValueAssign(redirects, t_temp_array);
139139
MCValueRelease(t_temp_array);
@@ -168,7 +168,7 @@ bool MCDeployParameters::InitWithArray(MCExecContext &ctxt, MCArrayRef p_array)
168168
MCValueAssign(output, t_temp_string);
169169
MCValueRelease(t_temp_string);
170170

171-
if (!ctxt.CopyElementAsArray(p_array, MCNAME("version"), false, t_temp_array))
171+
if (!ctxt.CopyOptElementAsArray(p_array, MCNAME("version"), false, t_temp_array))
172172
return false;
173173
MCValueAssign(version_info, t_temp_array);
174174
MCValueRelease(t_temp_array);
@@ -267,7 +267,7 @@ bool MCDeployWriteCapsule(const MCDeployParameters& p_params, MCDeployFileRef p_
267267
}
268268

269269
// Now add the startup script, if any.
270-
if (t_success && p_params . startup_script != nil)
270+
if (t_success && (!MCStringIsEmpty(p_params . startup_script)))
271271
t_success = MCDeployCapsuleDefineString(t_capsule, kMCCapsuleSectionTypeStartupScript, p_params . startup_script);
272272

273273
// Now a digest

engine/src/deploy_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
704704
if (t_success && t_project_section == NULL)
705705
t_success = MCDeployThrow(kMCDeployErrorLinuxNoProjectSection);
706706

707-
if (t_success && p_params . payload != NULL && t_payload_section == NULL)
707+
if (t_success && (!MCStringIsEmpty(p_params . payload)) && t_payload_section == NULL)
708708
t_success = MCDeployThrow(kMCDeployErrorLinuxNoPayloadSection);
709709

710710
// Next check that there are no sections after the project section.

engine/src/deploy_macosx.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ static bool MCDeployToMacOSXMain(const MCDeployParameters& p_params, bool p_big_
11171117
t_success = MCDeployThrow(kMCDeployErrorMacOSXNoLinkEditSegment);
11181118
if (t_success && t_project_segment == NULL)
11191119
t_success = MCDeployThrow(kMCDeployErrorMacOSXNoProjectSegment);
1120-
if (t_success && p_params . payload != NULL && t_payload_segment == NULL)
1120+
if (t_success && !(MCStringIsEmpty(p_params . payload)) && t_payload_segment == NULL)
11211121
t_success = MCDeployThrow(kMCDeployErrorMacOSXNoPayloadSegment);
11221122

11231123
// MW-2013-05-04: [[ iOSDeployMisc ]] If 'misc' segment is present but not between
@@ -1169,7 +1169,7 @@ static bool MCDeployToMacOSXMain(const MCDeployParameters& p_params, bool p_big_
11691169
if (t_success && t_payload_segment != NULL)
11701170
{
11711171
t_payload_offset = x_offset + t_output_offset;
1172-
if (p_params . payload != nil)
1172+
if (!MCStringIsEmpty(p_params . payload))
11731173
t_success = MCDeployWritePayload(p_params, p_big_endian, p_output, t_payload_offset, t_payload_size);
11741174
if (t_success)
11751175
t_output_offset += (t_payload_size + 4095) & ~4095;
@@ -1673,21 +1673,21 @@ Exec_stat MCDeployToMacOSX(const MCDeployParameters& p_params)
16731673

16741674
// MW-2013-06-13: First check that we either have 'engine' or (ppc and/or x86).
16751675
if (t_success &&
1676-
(p_params . engine != NULL && (p_params . engine_ppc != NULL || p_params . engine_x86 != NULL)))
1676+
(!MCStringIsEmpty(p_params . engine) && (!MCStringIsEmpty(p_params . engine_ppc) || !MCStringIsEmpty(p_params . engine_x86))))
16771677
t_success = MCDeployThrow(kMCDeployErrorNoEngine);
16781678

16791679
// MW-2013-06-13: Next check that we have at least one engine.
16801680
if (t_success &&
1681-
(p_params . engine == NULL && p_params . engine_ppc == NULL && p_params . engine_x86 == NULL))
1681+
(MCStringIsEmpty(p_params . engine) && MCStringIsEmpty(p_params . engine_ppc) && MCStringIsEmpty(p_params . engine_x86)))
16821682
t_success = MCDeployThrow(kMCDeployErrorNoEngine);
16831683

16841684
// Now open the files.
16851685
MCDeployFileRef t_engine, t_engine_ppc, t_engine_x86, t_output;
16861686
t_engine = t_engine_ppc = t_engine_x86 = t_output = NULL;
16871687
if (t_success &&
1688-
(p_params . engine != NULL && !MCDeployFileOpen(p_params . engine, kMCSOpenFileModeRead, t_engine) ||
1689-
p_params . engine_ppc != NULL && !MCDeployFileOpen(p_params . engine_ppc, kMCSOpenFileModeRead, t_engine_ppc) ||
1690-
p_params . engine_x86 != NULL && !MCDeployFileOpen(p_params . engine_x86, kMCSOpenFileModeRead, t_engine_x86)))
1688+
((!MCStringIsEmpty(p_params . engine) && !MCDeployFileOpen(p_params . engine, kMCSOpenFileModeRead, t_engine)) ||
1689+
(!MCStringIsEmpty(p_params . engine_ppc) && !MCDeployFileOpen(p_params . engine_ppc, kMCSOpenFileModeRead, t_engine_ppc)) ||
1690+
(!MCStringIsEmpty(p_params . engine_x86) && !MCDeployFileOpen(p_params . engine_x86, kMCSOpenFileModeRead, t_engine_x86))))
16911691
t_success = MCDeployThrow(kMCDeployErrorNoEngine);
16921692

16931693
if (t_success && !MCDeployFileOpen(p_params . output, kMCSOpenFileModeWrite, t_output))
@@ -1823,7 +1823,7 @@ Exec_stat MCDeployToIOS(const MCDeployParameters& p_params, bool p_embedded)
18231823
MCDeployFileRef t_engine, t_output;
18241824
t_engine = t_output = NULL;
18251825
if (t_success &&
1826-
(p_params . engine == NULL || !MCDeployFileOpen(p_params . engine, kMCSOpenFileModeRead, t_engine)))
1826+
((MCStringIsEmpty(p_params . engine)) || !MCDeployFileOpen(p_params . engine, kMCSOpenFileModeRead, t_engine)))
18271827
t_success = MCDeployThrow(kMCDeployErrorNoEngine);
18281828

18291829
// Make sure we can open the output file.

engine/src/dskmac.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,7 @@ struct MCMacSystemService: public MCMacSystemServiceInterface//, public MCMacDes
34643464
short fRefNum;
34653465
MCS_mac_openresourcefork_with_path(p_filename, fsRdPerm, false, &fRefNum, &t_open_res_error_string); // RESFORK
34663466

3467-
if (!MCStringIsEmpty(*t_open_res_error_string))
3467+
if (*t_open_res_error_string != nil)
34683468
{
34693469
MCresult -> setvalueref(*t_open_res_error_string);
34703470
return;
@@ -3547,14 +3547,14 @@ struct MCMacSystemService: public MCMacSystemServiceInterface//, public MCMacDes
35473547
bool t_fork_opened;
35483548
t_fork_opened = false;
35493549

3550-
if (*t_error != nil)
3550+
if (*t_error == nil)
35513551
{
35523552
MCS_mac_openresourcefork_with_path(p_path, fsWrPerm, true, &t_fork_ref, &t_error); // RESFORK
3553-
if (MCStringGetLength(*t_error))
3553+
if (*t_error == nil)
35543554
t_fork_opened = true;
35553555
}
35563556

3557-
if (*t_error != nil)
3557+
if (*t_error == nil)
35583558
{
35593559
OSErr t_os_error;
35603560
ByteCount t_actual_count;
@@ -3568,7 +3568,7 @@ struct MCMacSystemService: public MCMacSystemServiceInterface//, public MCMacDes
35683568
if (t_fork_opened)
35693569
FSCloseFork(t_fork_ref);
35703570

3571-
if (MCStringGetLength(*t_error) != 0)
3571+
if (*t_error != nil)
35723572
/* UNCHECKED */ MCresult -> setvalueref(*t_error);
35733573
else
35743574
MCresult -> clear(False);

0 commit comments

Comments
 (0)