Repository: syncthing/syncthing
File: lib/config/folderconfiguration.go (Go)

Code before:
	return c
}

func (f FolderConfiguration) Filesystem() fs.Filesystem {
	// This is intentionally not a pointer method, because things like
	// cfg.Folders["default"].Filesystem() should be valid.
	if f.cachedFilesystem == nil {
		l.Infoln("bug: uncached filesystem call (should only happen in tests)")
		return fs.NewFilesystem(f.FilesystemType, f.Path)
	}
	return f.cachedFilesystem
}

func (f FolderConfiguration) Versioner() versioner.Versioner {
	if f.Versioning.Type == "" {
		return nil
	}
	versionerFactory, ok := versioner.Factories[f.Versioning.Type]
	if !ok {
		panic(fmt.Sprintf("Requested versioning type %q that does not exist", f.Versioning.Type))
	}

	return versionerFactory(f.ID, f.Filesystem(), f.Versioning.Params)
}

func (f FolderConfiguration) ModTimeWindowS() int {
	return f.cachedModTimeWindowS
}

func (f *FolderConfiguration) CreateMarker() error {
	if err := f.CheckPath(); err != ErrMarkerMissing {
		return err
	}
	if f.MarkerName != DefaultMarkerName {
		// Folder uses a non-default marker so we shouldn't mess with it.
		// Pretend we created it and let the subsequent health checks sort
		// out the actual situation.
		return nil
	}

	permBits := fs.FileMode(0777)
	if runtime.GOOS == "windows" {
		// Windows has no umask so we must chose a safer set of bits to
		// begin with.
		permBits = 0700
	}
	fs := f.Filesystem()
	err := fs.Mkdir(DefaultMarkerName, permBits)
	if err != nil {
		return err
	}

Review comment (suggestion):
I think this function should be `ModTimeWindow() time.Duration` (and hence also the call sequence all the way down to `ModTimeEqual`) instead of `...S int`. 

The actual config values are typically seconds to avoid billions in the xml file, but given this is a function anyway...

Code after:
	c.Versioning = f.Versioning.Copy()
	return c
}

func (f FolderConfiguration) Filesystem() fs.Filesystem {
	// This is intentionally not a pointer method, because things like
	// cfg.Folders["default"].Filesystem() should be valid.
	if f.cachedFilesystem == nil {
		l.Infoln("bug: uncached filesystem call (should only happen in tests)")
		return fs.NewFilesystem(f.FilesystemType, f.Path)
	}
	return f.cachedFilesystem
}

func (f FolderConfiguration) Versioner() versioner.Versioner {
	if f.Versioning.Type == "" {
		return nil
	}
	versionerFactory, ok := versioner.Factories[f.Versioning.Type]
	if !ok {
		panic(fmt.Sprintf("Requested versioning type %q that does not exist", f.Versioning.Type))
	}

	return versionerFactory(f.ID, f.Filesystem(), f.Versioning.Params)
}

func (f FolderConfiguration) ModTimeWindow() time.Duration {
	return f.cachedModTimeWindow
}

func (f *FolderConfiguration) CreateMarker() error {
	if err := f.CheckPath(); err != ErrMarkerMissing {
		return err
	}
	if f.MarkerName != DefaultMarkerName {
		// Folder uses a non-default marker so we shouldn't mess with it.
		// Pretend we created it and let the subsequent health checks sort
		// out the actual situation.
		return nil
	}

	permBits := fs.FileMode(0777)
	if runtime.GOOS == "windows" {
		// Windows has no umask so we must chose a safer set of bits to
		// begin with.
		permBits = 0700
	}
	fs := f.Filesystem()
	err := fs.Mkdir(DefaultMarkerName, permBits)
	if err != nil {
		return err