--[[----------------------------------------------------------------------------

WFFolderWalker.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2015 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

	-- WF.core.os
local WFFolderWalkerImp = require 'WFFolderWalkerImp'

	-- WF.core.utils
local WFArguments = require 'WFArguments'

local WFPlatformInfo = require "WFPlatformInfo"

--------------------------------------------------------------------------------

local check = assert( WFArguments.check )

local createImp = assert( WFFolderWalkerImp.create )
local nextFile = assert( WFFolderWalkerImp.nextFile )


--============================================================================--
--[[
	This function returns an iterator that walks all of the files inside this path,
	which is presumed to be a folder.

	/param folderPath (string) path to folder
	/param options (optional, table) any of the following options

	- /c includeHiddenFiles include files that are normally hidden by the file system
]]--

return function( folderPath, options )

	check( '+string', '?table' )

	local skipHidden = not ( options and options.includeHiddenFiles )

	if WFPlatformInfo.isCocoa then

		local shallow = options and options.shallow

		return nextFile, createImp( folderPath, skipHidden, shallow )

	else
	
		return nextFile, createImp( folderPath, skipHidden )

	end
	
end
