LM388 (or LM317) Torque (current) limiting motor driver
I don't see any way your second circuit would limit the current. Without a current shunt or some other sensor it has no way to know what current is even being drawn.
The first thing to note is that this is a linear regulator, so this circuit is going to be very inefficient.
The second note is that because the LM338 requires a very large 1.25V feedback voltage, the current shunt is going to waste a lot of power at all times.
That being said, here's a topology that might work:



simulate this circuit &ndash; Schematic created using CircuitLab
Important facts from the datasheet:

For current regulation applications, a single resistor whose resistance value is 1.25V/IO and power rating is greater than 1.25V^2/R must be used.


The device OUTPUT pin sources current necessary to make OUTPUT pin 1.25V greater than ADJUST terminal to provide output regulation.

The the low end of the current range would be determined by the series resistor. 2.5R for example would result in a 500mA limit. The resistor divider R1 can reduce this feedback voltage to increase the current. R3 ensures that there's an upper limit. In this case approximately 3A.
One major downside is that R2 is going to need to dissipate a lot of power at the high current setting, up to 20W in this example!
Another topology that might work is this one:



simulate this circuit
The switches represent a rotary switch where only one can be closed at a time (or a similar arrangement. Effectively turning the switch changes the shunt resistor and therefore the maximum current. It doesn't provide infinite adjustment, but it's simple and it wastes much less power at high current settings then the other solution.
Note that these diagrams don't include caps or protection diodes and such which may be needed.