rhodes 3.3.2.beta.1 → 3.3.2.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +5 -5
- data/Rakefile +1 -1
- data/doc/build.txt +27 -1
- data/doc/device-caps.txt +65 -18
- data/doc/install.txt +5 -3
- data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.sln +30 -0
- data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.vcproj +159 -5
- data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +2 -2
- data/lib/extensions/digest-md5/ext/digest-md5.sln +44 -0
- data/lib/extensions/digest-sha1/ext/Rakefile +2 -2
- data/lib/extensions/digest-sha1/ext/digest-sha1.sln +44 -0
- data/lib/framework/rho/rhofsconnector.rb +9 -6
- data/lib/framework/rhom/rhom_db_adapter.rb +10 -0
- data/platform/android/Rhodes/jni/src/logconf.cpp +5 -0
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +7 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +82 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoLogConf.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +87 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +77 -159
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +4 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +6 -31
- data/platform/iphone/Classes/AppManager/AppManager.m +106 -29
- data/platform/iphone/Classes/Rhodes.m +27 -0
- data/platform/iphone/rbuild/iphone.rake +1 -1
- data/platform/shared/common/RhodesApp.cpp +10 -2
- data/platform/shared/common/RhodesAppBase.cpp +20 -4
- data/platform/shared/common/RhodesAppBase.h +4 -0
- data/platform/shared/db/DBAdapter.cpp +4 -6
- data/platform/shared/logging/RhoLogConf.cpp +2 -7
- data/platform/shared/logging/RhoLogConf.h +4 -0
- data/platform/shared/net/HttpServer.cpp +2 -2
- data/platform/shared/net/RawSocket.cpp +3 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +7 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -1
- data/platform/shared/ruby/ext/rho/rhosupport.c +9 -3
- data/platform/shared/ruby/ext/system/system.i +4 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +40 -1
- data/platform/wm/build/wm.rake +15 -5
- data/platform/wm/rhodes/LogView.cpp +25 -1
- data/platform/wm/rhodes/LogView.h +13 -0
- data/platform/wm/rhodes/MainWindow.cpp +4 -0
- data/platform/wm/rhodes/Rhodes.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +240 -145
- data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +24 -5
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +8 -1
- data/platform/wm/tools/detool/detool.cpp +88 -7
- data/platform/wm/tools/detool/detool.vcproj +2 -2
- data/platform/wm/tools/detool/stdafx.h +1 -0
- data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +2 -2
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +4 -4
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +8 -3
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +25 -6
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +23 -13
- data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +6 -1
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +33 -2
- data/platform/wp7/build/wp.rake +52 -0
- data/rakefile.rb +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/Settings/controller.rb +1 -1
- data/res/generators/templates/application/app/Settings/err_sync.erb +11 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.sln +22 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +2 -2
- data/spec/phone_spec/app/SpecRunner/index.erb +0 -1
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +1 -11
- data/spec/phone_spec/app/spec/blobsync_spec.rb +7 -2
- data/spec/phone_spec/app/spec/date_spec.rb +1 -1
- data/spec/phone_spec/app/spec/json_spec.rb +0 -3
- data/spec/phone_spec/app/spec/syncengine_spec.rb +6 -2
- data/spec/phone_spec/app/spec_runner.rb +10 -7
- data/version +1 -1
- metadata +9 -9
- data/platform/wm/tools/wmdc_connect/stdafx.cpp +0 -27
- data/platform/wm/tools/wmdc_connect/stdafx.h +0 -35
- data/platform/wm/tools/wmdc_connect/wmdc_connect.cpp +0 -119
- data/platform/wm/tools/wmdc_connect/wmdc_connect.vcproj +0 -205
- data/platform/wm/tools/wmdc_connect.sln +0 -20
@@ -45,6 +45,7 @@
|
|
45
45
|
|
46
46
|
#import "common/app_build_configs.h"
|
47
47
|
|
48
|
+
#include <sys/xattr.h>
|
48
49
|
|
49
50
|
#undef DEFAULT_LOGCATEGORY
|
50
51
|
#define DEFAULT_LOGCATEGORY "RhodesApp"
|
@@ -124,7 +125,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
124
125
|
}
|
125
126
|
|
126
127
|
+ (NSString *) getDbPath {
|
127
|
-
NSString *documentsDirectory = [NSString stringWithUTF8String:
|
128
|
+
NSString *documentsDirectory = [NSString stringWithUTF8String:rho_native_rhodbpath()];
|
128
129
|
return [documentsDirectory stringByAppendingPathComponent:@"db"];
|
129
130
|
}
|
130
131
|
|
@@ -213,9 +214,10 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
213
214
|
NSString *bundleRoot = [[NSBundle mainBundle] resourcePath];
|
214
215
|
NSString *rhoRoot = [NSString stringWithUTF8String:rho_native_rhopath()];
|
215
216
|
NSString *rhoUserRoot = [NSString stringWithUTF8String:rho_native_rhouserpath()];
|
217
|
+
NSString *rhoDBRoot = [NSString stringWithUTF8String:rho_native_rhodbpath()];
|
216
218
|
|
217
219
|
NSString *filePathNew = [bundleRoot stringByAppendingPathComponent:@"name"];
|
218
|
-
NSString *filePathOld = [
|
220
|
+
NSString *filePathOld = [rhoRoot stringByAppendingPathComponent:@"name"];
|
219
221
|
//#ifndef RHO_DONT_COPY_ON_START
|
220
222
|
BOOL hasOldName = [fileManager fileExistsAtPath:filePathOld];
|
221
223
|
//#endif
|
@@ -228,7 +230,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
228
230
|
contentChanged = YES;
|
229
231
|
else {
|
230
232
|
filePathNew = [bundleRoot stringByAppendingPathComponent:@"hash"];
|
231
|
-
filePathOld = [
|
233
|
+
filePathOld = [rhoRoot stringByAppendingPathComponent:@"hash"];
|
232
234
|
|
233
235
|
contentChanged = ![self isContentsEqual:fileManager first:filePathNew second:filePathOld];
|
234
236
|
|
@@ -280,6 +282,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
280
282
|
|
281
283
|
NSString *appsDocDir = [rhoUserRoot stringByAppendingPathComponent:@"apps"];
|
282
284
|
[fileManager createDirectoryAtPath:rhoRoot withIntermediateDirectories:YES attributes:nil error:&error];
|
285
|
+
|
283
286
|
[fileManager createDirectoryAtPath:appsDocDir withIntermediateDirectories:YES attributes:nil error:&error];
|
284
287
|
|
285
288
|
// Create symlink to "lib"
|
@@ -292,8 +295,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
292
295
|
[fileManager createSymbolicLinkAtPath:dst withDestinationPath:src error:&error];
|
293
296
|
//[self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:YES];
|
294
297
|
|
295
|
-
|
296
|
-
NSString *dirs[] = {@"apps"};
|
298
|
+
NSString *dirs[] = {@"apps", @"db"};
|
297
299
|
for (int i = 0, lim = sizeof(dirs)/sizeof(dirs[0]); i < lim; ++i) {
|
298
300
|
// Create directory
|
299
301
|
src = [bundleRoot stringByAppendingPathComponent:dirs[i]];
|
@@ -304,6 +306,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
304
306
|
[fileManager createDirectoryAtPath:dst withIntermediateDirectories:YES attributes:nil error:&error];
|
305
307
|
|
306
308
|
// And make symlinks from its content
|
309
|
+
|
307
310
|
NSArray *subelements = [fileManager contentsOfDirectoryAtPath:src error:&error];
|
308
311
|
for (int i = 0, lim = [subelements count]; i < lim; ++i) {
|
309
312
|
NSString *child = [subelements objectAtIndex:i];
|
@@ -321,14 +324,21 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
321
324
|
else {
|
322
325
|
[fileManager createSymbolicLinkAtPath:target withDestinationPath:fchild error:&error];
|
323
326
|
}
|
327
|
+
//[self addSkipBackupAttributeToItemAtURL:target];
|
324
328
|
}
|
325
329
|
}
|
326
330
|
|
331
|
+
// make symlinks for db files
|
332
|
+
|
327
333
|
[fileManager setDelegate:nil];
|
328
334
|
if (myDelegate != nil) {
|
329
335
|
[myDelegate release];
|
330
336
|
}
|
331
337
|
// copy "db"
|
338
|
+
|
339
|
+
|
340
|
+
NSString* exclude_db[] = {@"syncdb.schema", @"syncdb.triggers", @"syncdb_java.triggers"};
|
341
|
+
|
332
342
|
if (!restoreSymLinks_only) {
|
333
343
|
NSString *copy_dirs[] = {@"db"};
|
334
344
|
for (int i = 0, lim = sizeof(copy_dirs)/sizeof(copy_dirs[0]); i < lim; ++i) {
|
@@ -337,19 +347,46 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
|
|
337
347
|
remove = NO;
|
338
348
|
NSString *src = [bundleRoot stringByAppendingPathComponent:copy_dirs[i]];
|
339
349
|
NSLog(@"copy src: %@", src);
|
340
|
-
NSString *dst = [
|
350
|
+
NSString *dst = [rhoDBRoot stringByAppendingPathComponent:copy_dirs[i]];
|
341
351
|
NSLog(@"copy dst: %@", dst);
|
342
|
-
|
352
|
+
|
353
|
+
//[self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:remove];
|
354
|
+
|
355
|
+
NSArray *subelements = [fileManager contentsOfDirectoryAtPath:src error:&error];
|
356
|
+
for (int i = 0, lim = [subelements count]; i < lim; ++i) {
|
357
|
+
NSString *child = [subelements objectAtIndex:i];
|
358
|
+
NSString *fchild = [src stringByAppendingPathComponent:child];
|
359
|
+
NSLog(@" .. copy src: %@", fchild);
|
360
|
+
NSString *target = [dst stringByAppendingPathComponent:child];
|
361
|
+
NSLog(@" .. copy dst: %@", target);
|
362
|
+
|
363
|
+
BOOL copyit = YES;
|
364
|
+
|
365
|
+
int j, jlim;
|
366
|
+
for (j = 0, jlim = sizeof(exclude_db)/sizeof(exclude_db[0]); j < jlim; j++) {
|
367
|
+
if ([child isEqualToString:exclude_db[j]]) {
|
368
|
+
copyit = NO;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
if (copyit) {
|
373
|
+
[fileManager removeItemAtPath:target error:&error];
|
374
|
+
[fileManager copyItemAtPath:fchild toPath:target error:&error];
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
343
378
|
}
|
344
379
|
// Finally, copy "hash" and "name" files
|
345
380
|
NSString *items[] = {@"hash", @"name"};
|
346
381
|
for (int i = 0, lim = sizeof(items)/sizeof(items[0]); i < lim; ++i) {
|
347
382
|
NSString *src = [bundleRoot stringByAppendingPathComponent:items[i]];
|
348
383
|
NSLog(@"copy src: %@", src);
|
349
|
-
NSString *dst = [
|
384
|
+
NSString *dst = [rhoRoot stringByAppendingPathComponent:items[i]];
|
350
385
|
NSLog(@"copy dst: %@", dst);
|
351
386
|
[fileManager removeItemAtPath:dst error:&error];
|
352
387
|
[fileManager copyItemAtPath:src toPath:dst error:&error];
|
388
|
+
|
389
|
+
//[self addSkipBackupAttributeToItemAtURL:dst];
|
353
390
|
}
|
354
391
|
}
|
355
392
|
#else
|
@@ -422,28 +459,34 @@ const char* getUserPath() {
|
|
422
459
|
return root;
|
423
460
|
}
|
424
461
|
|
425
|
-
|
426
|
-
|
427
462
|
const char* rho_native_rhopath()
|
428
463
|
{
|
429
|
-
BOOL all_in_doc = NO;
|
430
|
-
const char* svalue = get_app_build_config_item("iphone_all_in_doc_folder");
|
431
|
-
if (svalue != NULL) {
|
432
|
-
all_in_doc = svalue[0] != '0';
|
433
|
-
}
|
434
|
-
|
435
|
-
if (all_in_doc) {
|
436
|
-
return getUserPath();
|
437
|
-
}
|
438
|
-
|
439
464
|
static bool loaded = FALSE;
|
440
465
|
static char root[FILENAME_MAX];
|
441
466
|
if (!loaded){
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
467
|
+
|
468
|
+
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
469
|
+
NSString *rootDirectory = [ [paths objectAtIndex:0] stringByAppendingString:@"/Private Documents/"];
|
470
|
+
|
471
|
+
const char* svalue = get_app_build_config_item("iphone_set_approot");
|
472
|
+
if (svalue != NULL) {
|
473
|
+
NSString* value = [NSString stringWithUTF8String:svalue];
|
474
|
+
|
475
|
+
if ([value compare:@"Documents" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
476
|
+
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
477
|
+
rootDirectory = [ [paths objectAtIndex:0] stringByAppendingString:@"/"];
|
478
|
+
}
|
479
|
+
else if ([value compare:@"Library_Caches" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
480
|
+
paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
481
|
+
rootDirectory = [ [paths objectAtIndex:0] stringByAppendingString:@"/Private Documents/"];
|
482
|
+
}
|
483
|
+
else if ([value compare:@"Library_Private_Documents" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
484
|
+
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
|
485
|
+
rootDirectory = [ [paths objectAtIndex:0] stringByAppendingString:@"/Private Documents/"];
|
486
|
+
}
|
487
|
+
}
|
488
|
+
|
489
|
+
[rootDirectory getFileSystemRepresentation:root maxLength:sizeof(root)];
|
447
490
|
loaded = TRUE;
|
448
491
|
}
|
449
492
|
|
@@ -452,19 +495,39 @@ const char* rho_native_rhopath()
|
|
452
495
|
|
453
496
|
const char* rho_native_rhouserpath()
|
454
497
|
{
|
455
|
-
BOOL
|
456
|
-
const char* svalue = get_app_build_config_item("
|
498
|
+
BOOL user_path_in_root = NO;
|
499
|
+
const char* svalue = get_app_build_config_item("iphone_userpath_in_approot");
|
457
500
|
if (svalue != NULL) {
|
458
|
-
|
501
|
+
user_path_in_root = svalue[0] != '0';
|
459
502
|
}
|
460
503
|
|
461
|
-
if (
|
504
|
+
if (user_path_in_root) {
|
462
505
|
return rho_native_rhopath();
|
463
506
|
}
|
464
507
|
|
465
508
|
return getUserPath();
|
466
509
|
}
|
467
510
|
|
511
|
+
const char* rho_native_rhodbpath()
|
512
|
+
{
|
513
|
+
BOOL db_path_in_root = NO;
|
514
|
+
const char* svalue = get_app_build_config_item("iphone_db_in_approot");
|
515
|
+
if (svalue != NULL) {
|
516
|
+
db_path_in_root = svalue[0] != '0';
|
517
|
+
}
|
518
|
+
|
519
|
+
if (db_path_in_root) {
|
520
|
+
return rho_native_rhopath();
|
521
|
+
}
|
522
|
+
return rho_native_rhouserpath();
|
523
|
+
}
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
468
531
|
VALUE rho_sys_get_locale()
|
469
532
|
{
|
470
533
|
NSString *preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0];
|
@@ -827,6 +890,20 @@ void rho_platform_restart_application() {
|
|
827
890
|
// [Rhodes restart_app];
|
828
891
|
}
|
829
892
|
|
893
|
+
int rho_sys_set_do_not_bakup_attribute(const char* path, int value) {
|
894
|
+
const char* attrName = "com.apple.MobileBackup";
|
895
|
+
u_int8_t attrValue = value;
|
896
|
+
|
897
|
+
int result = setxattr(path, attrName, &attrValue, sizeof(attrValue), 0, 0);
|
898
|
+
|
899
|
+
if (result != 0) {
|
900
|
+
NSLog(@"Can not change [do_not_bakup] attribute for path: %@", [NSString stringWithUTF8String:path]);
|
901
|
+
}
|
902
|
+
|
903
|
+
return (int)(result == 0);
|
904
|
+
}
|
905
|
+
|
906
|
+
|
830
907
|
/*
|
831
908
|
#define MAX_ACTIONS 4
|
832
909
|
const static struct {
|
@@ -42,6 +42,21 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
+
/*
|
46
|
+
use this non-public code for see level of memory warning
|
47
|
+
|
48
|
+
typedef enum {
|
49
|
+
OSMemoryNotificationLevelAny = -1,
|
50
|
+
OSMemoryNotificationLevelNormal = 0,
|
51
|
+
OSMemoryNotificationLevelWarning = 1,
|
52
|
+
OSMemoryNotificationLevelUrgent = 2,
|
53
|
+
OSMemoryNotificationLevelCritical = 3
|
54
|
+
} OSMemoryNotificationLevel;
|
55
|
+
|
56
|
+
extern OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void);
|
57
|
+
*/
|
58
|
+
|
59
|
+
|
45
60
|
extern int rho_sys_check_rollback_bundle(const char* szRhoPath);
|
46
61
|
void rho_sys_impl_exit_with_errormessage(const char* szTitle, const char* szMsg);
|
47
62
|
|
@@ -1009,6 +1024,18 @@ static Rhodes *instance = NULL;
|
|
1009
1024
|
}
|
1010
1025
|
#endif
|
1011
1026
|
|
1027
|
+
|
1028
|
+
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
|
1029
|
+
{
|
1030
|
+
RAWLOG_INFO("Application receive Memory Warning !!!");
|
1031
|
+
/*
|
1032
|
+
int level = OSMemoryNotificationCurrentLevel();
|
1033
|
+
|
1034
|
+
int o;
|
1035
|
+
o = 9;
|
1036
|
+
*/
|
1037
|
+
}
|
1038
|
+
|
1012
1039
|
- (void)applicationWillTerminate:(UIApplication *)application {
|
1013
1040
|
RAWLOG_INFO("Runner will terminate");
|
1014
1041
|
rho_rhodesapp_callUiDestroyedCallback();
|
@@ -1067,7 +1067,7 @@ namespace "run" do
|
|
1067
1067
|
end
|
1068
1068
|
|
1069
1069
|
#>>>>>>>>>>
|
1070
|
-
|
1070
|
+
#`echo "#{$applog}" > "#{$simrhodes}/Documents/rhologpath.txt"`
|
1071
1071
|
rholog = simapp + "/" + $guid + "/Library/Private Documents/rholog.txt"
|
1072
1072
|
|
1073
1073
|
|
@@ -914,9 +914,17 @@ int CRhodesApp::determineFreeListeningPort()
|
|
914
914
|
void CRhodesApp::initAppUrls()
|
915
915
|
{
|
916
916
|
CRhodesAppBase::initAppUrls();
|
917
|
-
|
918
|
-
#if defined(
|
917
|
+
|
918
|
+
#if defined( __SYMBIAN32__ ) || defined( OS_ANDROID )
|
919
919
|
m_strHomeUrl = "http://localhost:";
|
920
|
+
#elif defined( OS_WINCE ) && !defined(OS_PLATFORM_MOTCE)
|
921
|
+
TCHAR oem[257];
|
922
|
+
SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(oem), oem, 0);
|
923
|
+
// LOG(INFO) + oem;
|
924
|
+
if ((_tcscmp(oem, _T("MC75"))==0) || (_tcscmp(oem, _T("MC75A"))==0))
|
925
|
+
m_strHomeUrl = "http://localhost:";
|
926
|
+
else
|
927
|
+
m_strHomeUrl = "http://127.0.0.1:";
|
920
928
|
#else
|
921
929
|
m_strHomeUrl = "http://127.0.0.1:";
|
922
930
|
#endif
|
@@ -64,8 +64,11 @@ CRhodesAppBase::CRhodesAppBase(const String& strRootPath, const String& strUserP
|
|
64
64
|
void CRhodesAppBase::initAppUrls()
|
65
65
|
{
|
66
66
|
#ifndef RHODES_EMULATOR
|
67
|
-
|
68
|
-
|
67
|
+
|
68
|
+
String db_dir = rho_native_rhodbpath();
|
69
|
+
|
70
|
+
m_strBlobsDirPath = db_dir + "db/db-files";
|
71
|
+
m_strDBDirPath = db_dir + "db";
|
69
72
|
|
70
73
|
m_strAppRootPath = getRhoRootPath() + "apps";
|
71
74
|
//m_strRhodesPath = "";
|
@@ -80,7 +83,7 @@ void CRhodesAppBase::initAppUrls()
|
|
80
83
|
String CRhodesAppBase::getRelativeDBFilesPath(const String& strFilePath)
|
81
84
|
{
|
82
85
|
#ifndef RHODES_EMULATOR
|
83
|
-
String strDbFileRoot =
|
86
|
+
String strDbFileRoot = rho_native_rhodbpath();//getRhoRootPath();
|
84
87
|
#else
|
85
88
|
String strDbFileRoot = getRhoRootPath() + RHO_EMULATOR_DIR;
|
86
89
|
#endif
|
@@ -94,7 +97,7 @@ String CRhodesAppBase::getRelativeDBFilesPath(const String& strFilePath)
|
|
94
97
|
String CRhodesAppBase::resolveDBFilesPath(const String& strFilePath)
|
95
98
|
{
|
96
99
|
#ifndef RHODES_EMULATOR
|
97
|
-
String strDbFileRoot =
|
100
|
+
String strDbFileRoot = rho_native_rhodbpath();//getRhoRootPath();
|
98
101
|
#else
|
99
102
|
String strDbFileRoot = getRhoRootPath() + RHO_EMULATOR_DIR;
|
100
103
|
#endif
|
@@ -313,4 +316,17 @@ const char* rho_native_rhouserpath()
|
|
313
316
|
{
|
314
317
|
return rho_native_rhopath();
|
315
318
|
}
|
319
|
+
|
320
|
+
const char* rho_native_rhodbpath()
|
321
|
+
{
|
322
|
+
return rho_native_rhopath();
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
int rho_sys_set_do_not_bakup_attribute(const char* path, int value)
|
327
|
+
{
|
328
|
+
// nothing
|
329
|
+
return 1;
|
330
|
+
}
|
331
|
+
|
316
332
|
#endif
|
@@ -89,6 +89,7 @@ extern "C" {
|
|
89
89
|
|
90
90
|
const char* rho_native_rhopath();
|
91
91
|
const char* rho_native_rhouserpath();
|
92
|
+
const char* rho_native_rhodbpath();
|
92
93
|
|
93
94
|
const char* rho_rhodesapp_getplatform();
|
94
95
|
//const char* rho_rhodesapp_getrhodespath();
|
@@ -100,6 +101,9 @@ void rho_free_callbackdata(void* pData);
|
|
100
101
|
|
101
102
|
int rho_base64_encode(const char *src, int srclen, char *dst);
|
102
103
|
int rho_base64_decode(const char *src, int srclen, char *dst);
|
104
|
+
|
105
|
+
int rho_sys_set_do_not_bakup_attribute(const char* path, int value);
|
106
|
+
|
103
107
|
|
104
108
|
#ifdef __cplusplus
|
105
109
|
};
|
@@ -701,13 +701,12 @@ void CDBAdapter::createSchema()
|
|
701
701
|
{
|
702
702
|
#ifdef RHODES_EMULATOR
|
703
703
|
String strPath = CFilePath::join( RHOSIMCONF().getRhodesPath(), "platform/shared/db/res/db/syncdb.schema" );
|
704
|
-
CFilePath oPath(strPath);
|
705
704
|
#else
|
706
|
-
CFilePath
|
705
|
+
String strPath = CFilePath::join( RHODESAPP().getRhoRootPath(), "db/syncdb.schema" );
|
707
706
|
#endif
|
708
707
|
|
709
708
|
String strSqlScript;
|
710
|
-
CRhoFile::loadTextFile(
|
709
|
+
CRhoFile::loadTextFile(strPath.c_str(), strSqlScript);
|
711
710
|
|
712
711
|
if ( strSqlScript.length() == 0 )
|
713
712
|
{
|
@@ -727,13 +726,12 @@ void CDBAdapter::createTriggers()
|
|
727
726
|
char* errmsg = 0;
|
728
727
|
#ifdef RHODES_EMULATOR
|
729
728
|
String strPath = CFilePath::join( RHOSIMCONF().getRhodesPath(), "platform/shared/db/res/db/syncdb.triggers" );
|
730
|
-
CFilePath oPath(strPath);
|
731
729
|
#else
|
732
|
-
CFilePath
|
730
|
+
String strPath = CFilePath::join( RHODESAPP().getRhoRootPath(), "db/syncdb.triggers" );
|
733
731
|
#endif
|
734
732
|
|
735
733
|
String strSqlTriggers;
|
736
|
-
CRhoFile::loadTextFile(
|
734
|
+
CRhoFile::loadTextFile(strPath.c_str(), strSqlTriggers);
|
737
735
|
|
738
736
|
if ( strSqlTriggers.length() == 0 )
|
739
737
|
{
|
@@ -266,16 +266,11 @@ void rho_logconf_Init_with_separate_user_path(const char* szRootPath, const char
|
|
266
266
|
rho_conf_Init_with_separate_user_path(szRootPath, szUserPath);
|
267
267
|
|
268
268
|
LOGCONF().loadFromConf(RHOCONF());
|
269
|
-
if (szLogPort != NULL)
|
269
|
+
if ( szLogPort != NULL && *szLogPort )
|
270
270
|
LOGCONF().setLogPort(szLogPort);
|
271
|
-
|
272
|
-
else {
|
273
|
-
LOGCONF().setLogPort("");
|
274
|
-
}
|
275
|
-
|
271
|
+
|
276
272
|
}
|
277
273
|
|
278
|
-
|
279
274
|
void rho_logconf_Init(const char* szRootPath, const char* szLogPort){
|
280
275
|
rho_logconf_Init_with_separate_user_path(szRootPath, szLogPort, szRootPath);
|
281
276
|
}
|
@@ -971,8 +971,8 @@ bool CHttpServer::send_file(String const &path, HeaderList const &hdrs)
|
|
971
971
|
String fullPath = CFilePath::normalizePath(path);
|
972
972
|
|
973
973
|
if (String_startsWith(fullPath,"/app/db/db-files") )
|
974
|
-
fullPath = CFilePath::join(
|
975
|
-
else if (fullPath.find(m_root) != 0 && fullPath.find(m_strRhoRoot) != 0 && fullPath.find(m_strRhoUserRoot) != 0)
|
974
|
+
fullPath = CFilePath::join( rho_native_rhodbpath(), path.substr(4) );
|
975
|
+
else if (fullPath.find(m_root) != 0 && fullPath.find(m_strRhoRoot) != 0 && fullPath.find(m_userroot) != 0 && fullPath.find(m_strRhoUserRoot) != 0)
|
976
976
|
fullPath = CFilePath::join( m_root, path );
|
977
977
|
|
978
978
|
if (verbose) RAWTRACE1("Sending file %s...", fullPath.c_str());
|
@@ -130,6 +130,9 @@ bool RawSocket::send(const String& sendData)
|
|
130
130
|
{
|
131
131
|
int iResult = 0;
|
132
132
|
|
133
|
+
if ( m_clientSocket == INVALID_SOCKET )
|
134
|
+
return false;
|
135
|
+
|
133
136
|
// Send an initial buffer
|
134
137
|
iResult = ::send(m_clientSocket, sendData.c_str(), (int) sendData.size(), 0);
|
135
138
|
|
@@ -451,7 +451,7 @@ long rho_ruby_get_int(VALUE val)
|
|
451
451
|
return NUM2LONG(val);
|
452
452
|
}
|
453
453
|
|
454
|
-
|
454
|
+
VALUE rho_ruby_get_time(VALUE rDate)
|
455
455
|
{
|
456
456
|
VALUE res, cDate;
|
457
457
|
if (TYPE(rDate) == T_STRING) {
|
@@ -462,8 +462,12 @@ time_t rho_ruby_get_time(VALUE rDate)
|
|
462
462
|
if (!rb_equal(cDate, rb_cTime))
|
463
463
|
rb_raise(rb_eArgError, "Wrong type of parameter: %s (Time expected)", rb_class2name(cDate));
|
464
464
|
|
465
|
-
|
466
|
-
|
465
|
+
return rDate;
|
466
|
+
}
|
467
|
+
|
468
|
+
unsigned long rho_ruby_get_time_part(VALUE rDate, const char* szPart)
|
469
|
+
{
|
470
|
+
return NUM2LONG(rb_funcall(rDate, rb_intern(szPart), 0));
|
467
471
|
}
|
468
472
|
|
469
473
|
VALUE rho_ruby_create_array()
|
@@ -106,7 +106,8 @@ void rho_ruby_add_to_array(VALUE ar, VALUE val);
|
|
106
106
|
void rho_ruby_add_to_hash(VALUE hash, VALUE key, VALUE item);
|
107
107
|
|
108
108
|
|
109
|
-
|
109
|
+
VALUE rho_ruby_get_time(VALUE rTime);
|
110
|
+
unsigned long rho_ruby_get_time_part(VALUE rDate, const char* szPart);
|
110
111
|
|
111
112
|
VALUE rho_ruby_create_byte_array(unsigned char* buf, int length);
|
112
113
|
int rho_ruby_unpack_byte_array(VALUE array_value, unsigned char* buf, int max_length);
|
@@ -65,6 +65,10 @@ VALUE __rhoGetUserDir(void)
|
|
65
65
|
return rb_str_new2(rho_native_rhouserpath());
|
66
66
|
}
|
67
67
|
|
68
|
+
VALUE __rhoGetDBDir(void)
|
69
|
+
{
|
70
|
+
return rb_str_new2(rho_native_rhodbpath());
|
71
|
+
}
|
68
72
|
|
69
73
|
|
70
74
|
|
@@ -579,6 +583,7 @@ void Init_RhoSupport()
|
|
579
583
|
#endif
|
580
584
|
rb_define_global_function("__rhoGetCurrentDir", __rhoGetCurrentDir, 0);
|
581
585
|
rb_define_global_function("__rhoGetUserDir", __rhoGetUserDir, 0);
|
586
|
+
rb_define_global_function("__rhoGetDBDir", __rhoGetDBDir, 0);
|
582
587
|
rb_define_global_function("load", rb_load_compiled, 1);
|
583
588
|
rb_define_global_function("__rhoGetCallbackObject", __rhoGetCallbackObject, 1);
|
584
589
|
|
@@ -592,7 +597,7 @@ void Init_RhoSupport()
|
|
592
597
|
static void Init_RhoBlobs()
|
593
598
|
{
|
594
599
|
const char* szBlobPath = rho_rhodesapp_getblobsdirpath();
|
595
|
-
const char* szUserPath =
|
600
|
+
const char* szUserPath = rho_native_rhodbpath();
|
596
601
|
RAWLOG_INFO1("Init_RhoBlobs: %s", szBlobPath );
|
597
602
|
|
598
603
|
rho_file_recursive_createdir(szBlobPath, szUserPath);
|
@@ -786,7 +791,7 @@ const char* rho_ruby_internal_getErrorText(int nError)
|
|
786
791
|
|
787
792
|
return szValue;
|
788
793
|
}
|
789
|
-
|
794
|
+
/*
|
790
795
|
static void Init_RhoLog2()
|
791
796
|
{
|
792
797
|
VALUE path = __rhoGetCurrentDir();
|
@@ -809,7 +814,8 @@ static void Init_RhoLog2()
|
|
809
814
|
}
|
810
815
|
}
|
811
816
|
}
|
812
|
-
}
|
817
|
+
}*/
|
818
|
+
|
813
819
|
void rhoGCReport(VALUE valReport)
|
814
820
|
{
|
815
821
|
char *report = RSTRING_PTR(valReport);
|
@@ -69,6 +69,9 @@ extern void rho_sys_replace_current_bundle(const char* path);
|
|
69
69
|
#define delete_folder rho_sys_delete_folder
|
70
70
|
extern int rho_sys_delete_folder(const char* path);
|
71
71
|
|
72
|
+
#define set_do_not_bakup_attribute rho_sys_set_do_not_bakup_attribute
|
73
|
+
extern int rho_sys_set_do_not_bakup_attribute(const char* path, int value);
|
74
|
+
|
72
75
|
#if !defined(bool)
|
73
76
|
#define bool int
|
74
77
|
#define true 1
|
@@ -130,3 +133,4 @@ extern void stop_timer( const char *url);
|
|
130
133
|
extern void set_application_icon_badge(int badge_number);
|
131
134
|
extern void replace_current_bundle(const char* path);
|
132
135
|
extern int delete_folder(const char* path);
|
136
|
+
extern int set_do_not_bakup_attribute(const char* path, int value);
|
@@ -1894,6 +1894,9 @@ extern void rho_sys_replace_current_bundle(const char* path);
|
|
1894
1894
|
#define delete_folder rho_sys_delete_folder
|
1895
1895
|
extern int rho_sys_delete_folder(const char* path);
|
1896
1896
|
|
1897
|
+
#define set_do_not_bakup_attribute rho_sys_set_do_not_bakup_attribute
|
1898
|
+
extern int rho_sys_set_do_not_bakup_attribute(const char* path, int value);
|
1899
|
+
|
1897
1900
|
#if !defined(bool)
|
1898
1901
|
#define bool int
|
1899
1902
|
#define true 1
|
@@ -1973,7 +1976,7 @@ SWIG_ruby_failed(void)
|
|
1973
1976
|
}
|
1974
1977
|
|
1975
1978
|
|
1976
|
-
/*@SWIG
|
1979
|
+
/*@SWIG:/usr/local/share/swig/2.0.4/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
|
1977
1980
|
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
|
1978
1981
|
{
|
1979
1982
|
VALUE obj = args[0];
|
@@ -2664,6 +2667,41 @@ fail:
|
|
2664
2667
|
}
|
2665
2668
|
|
2666
2669
|
|
2670
|
+
SWIGINTERN VALUE
|
2671
|
+
_wrap_set_do_not_bakup_attribute(int argc, VALUE *argv, VALUE self) {
|
2672
|
+
char *arg1 = (char *) 0 ;
|
2673
|
+
int arg2 ;
|
2674
|
+
int res1 ;
|
2675
|
+
char *buf1 = 0 ;
|
2676
|
+
int alloc1 = 0 ;
|
2677
|
+
int val2 ;
|
2678
|
+
int ecode2 = 0 ;
|
2679
|
+
int result;
|
2680
|
+
VALUE vresult = Qnil;
|
2681
|
+
|
2682
|
+
if ((argc < 2) || (argc > 2)) {
|
2683
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
2684
|
+
}
|
2685
|
+
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
|
2686
|
+
if (!SWIG_IsOK(res1)) {
|
2687
|
+
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","set_do_not_bakup_attribute", 1, argv[0] ));
|
2688
|
+
}
|
2689
|
+
arg1 = (char *)(buf1);
|
2690
|
+
ecode2 = SWIG_AsVal_int(argv[1], &val2);
|
2691
|
+
if (!SWIG_IsOK(ecode2)) {
|
2692
|
+
SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","set_do_not_bakup_attribute", 2, argv[1] ));
|
2693
|
+
}
|
2694
|
+
arg2 = (int)(val2);
|
2695
|
+
result = (int)set_do_not_bakup_attribute((char const *)arg1,arg2);
|
2696
|
+
vresult = SWIG_From_int((int)(result));
|
2697
|
+
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
|
2698
|
+
return vresult;
|
2699
|
+
fail:
|
2700
|
+
if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
|
2701
|
+
return Qnil;
|
2702
|
+
}
|
2703
|
+
|
2704
|
+
|
2667
2705
|
|
2668
2706
|
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
2669
2707
|
|
@@ -2997,5 +3035,6 @@ SWIGEXPORT void Init_System(void) {
|
|
2997
3035
|
rb_define_module_function(mSystem, "set_application_icon_badge", _wrap_set_application_icon_badge, -1);
|
2998
3036
|
rb_define_module_function(mSystem, "replace_current_bundle", _wrap_replace_current_bundle, -1);
|
2999
3037
|
rb_define_module_function(mSystem, "delete_folder", _wrap_delete_folder, -1);
|
3038
|
+
rb_define_module_function(mSystem, "set_do_not_bakup_attribute", _wrap_set_do_not_bakup_attribute, -1);
|
3000
3039
|
}
|
3001
3040
|
|