Page 1 of 1

Backup on SD Card on Android

Posted: June 15th, 2018, 3:45 am
by Yass
Dear Cspro Team,

Please I have this folder structure
GNCR (Main folder) that contains subfolders : (1) Application - Contains Application (2)Menu Folder - Contains the Menu and (3) Data folder which Contains Sub folders which are MainData and ListingData. I then wrote the follow codes in my pff file to run backup anytime the pff file is written but i get path error.

The copy is done on the internal memory of the tablets with <invalid path> error. Kindly assist me as always.

Code: Select all

function gncr()

    string pffFilename1 = pathname(Application) + "../Application/gncr.pff";
	setfile(pffFile1,pffFilename1,create);
	...............................................................
	
    string GCABackup = pathname(CSEntryExternal) + maketext("Backup%d",timestamp());
    dircreate(GNCRBackup);
    if SU = 1 then
    
    if filecopy(pathname(Application) + "../Data/MainData/GNCRDATA.csdb",GCABackup) = default then 
        errmsg("Insert an SD card"); 
        
    elseif filecopy(pathname(Application) + "../Data/ListingData/LIST.csdb",GCABackup) = default then 
        errmsg("Insert an SD card");
   endif;
	

Re: Backup on SD Card on Android

Posted: June 15th, 2018, 7:18 am
by josh
The code looks ok so the error is probably in one of the paths. Double check that "Data/MainData/GNCRDATA.csdb" and "Data/ListingData/LIST.csdb" are correct.

I would use errmsg to print out the value of pathname(CSEntryExternal) to make sure the external SD directory is valid.

Also check the return value of dircreate to make sure it worked correctly.

Re: Backup on SD Card on Android

Posted: June 19th, 2018, 11:07 am
by Yass
Hi Josh,

I have tried severally , am unable to figure out the issue to write the backup, can kindly send you the application for a look. Thanks.

Re: Backup on SD Card on Android

Posted: June 19th, 2018, 11:25 am
by josh
Sure go ahead and send the application