79712694

Date: 2025-07-24 01:29:29
Score: 2
Natty:
Report link

@tomerpacific I am getting imagePath from const saveFileToStorageOmOrder in "app.tsx" . I move temporary files to a permanent location then enter the await addTimestampWithLocation function.

const saveFileToStorageOmOrder = async (sTempFilePath, iP_ID, iOO_ID, columnName) => {
        try {
            const sFolderPath = `${RNFS.ExternalDirectoryPath}/OmOrder/${iP_ID}/${iOO_ID}`;
            if (!await RNFS.exists(sFolderPath)) await RNFS.mkdir(sFolderPath);

            const ext = sTempFilePath.split('.').pop() || 'jpg';
            const now = new Date();
            const fileName = `${now.getFullYear()}${(now.getMonth()+1).toString().padStart(2,'0')}${now.getDate().toString().padStart(2,'0')}_${
                now.getHours().toString().padStart(2,'0')}${now.getMinutes().toString().padStart(2,'0')}${now.getSeconds().toString().padStart(2,'0')}.${ext}`;
            const sPermanentPath = `${sFolderPath}/${fileName}`;

            // 1. move temporary files to a permanent location
            await RNFS.moveFile(sTempFilePath, sPermanentPath);

            // 🟨 timestamp + location
            await addTimestampWithLocation(sPermanentPath);

            // 3. Save to JSON
            insertUpdateFileJsonOmOrder(sPermanentPath, iP_ID, iOO_ID, columnName);
        } catch (error) {
            _WriteLog(`❌ Error in saveFileToStorageOmOrder: ${error.message}`);
        }
    };
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @tomerpacific
  • Self-answer (0.5):
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: kittisak kea