Skip to content

Commit

Permalink
Merge pull request #220 from sasjs/path-fix
Browse files Browse the repository at this point in the history
fix: replace all backslashes with forward slash
  • Loading branch information
allanbowe authored Dec 20, 2022
2 parents 10a29cb + ce39dd6 commit 1334b2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/fs/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import {
import { HashedFolder } from '../types'
import { generatePathForSas } from '../utils'

// we need to inject this line to generated sas program
// ls means line size and ps means page size
// bigger page = less chance of hitting the page number
const OPTIONS = 'options ls=max ps=max;'

export const generateProgramToGetRemoteHash = async (remotePath: string) => {
const compiledMacrosCode = await getCompiledMacrosCode([
'mp_hashdirectory.sas',
Expand All @@ -21,7 +26,7 @@ export const generateProgramToGetRemoteHash = async (remotePath: string) => {

const codeForHashCreation = getCodeForHashCreation()

const code = compiledMacrosCode + codeForHashCreation
const code = OPTIONS + compiledMacrosCode + codeForHashCreation

return setTargetAtStart(code, remotePath)
}
Expand Down Expand Up @@ -56,11 +61,12 @@ export const generateProgramToSyncHashDiff = async (
const codeForHashCreation = getCodeForHashCreation()

const code =
'options ls=max;' +
OPTIONS +
compiledMacrosCode +
initialProgramContent +
folderCreationCode +
codeForHashCreation

return setTargetAtStart(code, remotePath)
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export const getMacrosPath = () => path.join(__dirname, '..', 'macros')
* So, this method replaces OS specific path separator with forward slash
*/
export const generatePathForSas = (resourcePath: string) =>
resourcePath.replace(path.sep, '/')
resourcePath.replace(/\\/g, '/')

0 comments on commit 1334b2d

Please sign in to comment.